Beispiel #1
0
        public static async Task <string> MakePredictionRequestByImageUrl(string imageUrl)
        {
            HttpClient client = new HttpClient();

            client.DefaultRequestHeaders.Add("Prediction-Key", AuthenticationManager.GetPredictionKey());

            HttpResponseMessage response;
            string contentJson = CSPrediction.CreateUrlContentBody(imageUrl);

            using (HttpContent content = new StringContent(contentJson))
            {
                content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
                response = await client.PostAsync(CSPrediction.PredictionUrl_ImageUrl, content);

                return(await response.Content.ReadAsStringAsync());
            }
        }
Beispiel #2
0
        public static async Task <string> MakePredictionRequestByImagePath(string imageFilePath)
        {
            byte[] byteData = GetImageAsByteArray(imageFilePath);

            return(await CSPrediction.MakePredictionRequestByImageByteData(byteData));
        }