/// <summary>
        /// Call the CPU-based model for our image
        /// </summary>
        /// <param name="jsonContent">
        /// The JSON representing the image, to be sent to the model.
        /// </param>
        /// <returns>
        /// If the call is successful, returns a ModelResponse object
        /// representing the result of the call. Otherwise returns null.
        /// </returns>
        private CpuModelResponse InvokeCpuModel(string jsonContent)
        {
            const string url = "http://grocerymodel:5001/score";

            try
            {
                using (var client = new HttpClient())
                {
                    var content = new StringContent(jsonContent);
                    content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
                    DateTime then     = DateTime.Now;
                    var      response = client.PostAsync(url, content).Result;
                    string   text     = response.Content.ReadAsStringAsync().Result;
                    // TODO: timing recognitionDuration = DateTime.Now - then;

                    Console.WriteLine($"POST return status code {response.StatusCode}");
                    Console.WriteLine(text);

                    if (response.IsSuccessStatusCode)
                    {
                        CpuModelResponse modelResponse = JsonConvert.DeserializeObject <CpuModelResponse>(text);
                        return(modelResponse);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Failure uploading to model.");
                Console.WriteLine(ex);
            }

            return(null);
        }
        public List <ImageFeature> Process(Google.Protobuf.ByteString image)
        {
            string imageJson = MakeImageJson(image);

            if (imageJson != null)
            {
                CpuModelResponse response = InvokeCpuModel(imageJson);
                if (response != null)
                {
                    List <ImageFeature> result = new List <ImageFeature>();
                    for (int i = 0; i < response.classes.Length; i++)
                    {
                        ImageFeature feature = new ImageFeature(response.classes[i],
                                                                response.scores[i], response.bboxes[i]);
                        result.Add(feature);
                    }
                    return(result);
                }
            }
            return(null);
        }