public async Task <Prediction> PredictAsync(Image <Rgba32> image) { var preprocessor = new Preprocessor(Rgba32.White, Rgba32.Black); image = preprocessor.Preprocess(image); var pixelArray = Preprocessor.ConvertImageToTwoDimensionalArray(image); var requestContent = new StringContent("{\"data\": " + JsonConvert.SerializeObject(new[] { pixelArray }) + "}"); requestContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); var response = await _httpClient.PostAsync(_apiUrl, requestContent); var responseContent = response.Content is HttpContent c ? await c.ReadAsStringAsync() : null; //var prediction = JsonConvert.DeserializeObject<>(responseContent); //var tag = prediction.Predictions.OrderByDescending(p => p.Probability).First(); return(new Prediction { Tag = 0, Probability = 0 }); }