Example #1
0
 public string Get(IFormFile image)
 {
     try
     {
         var imageBytes = image.ToByteArray();
         var(label, probability) = _imageRecognitionService.Recognize(imageBytes);
         probability             = Math.Round(probability, 2);
         return($"Matched element {label} with probability {probability}");
     }
     catch (ImageRecognitionException ex)
     {
         return($"Couldn't match uploaded image. Error details: {ex.Message}");
     }
     catch (Exception ex)
     {
         return($"There was an error. Error details: {ex.Message}");
     }
 }