Created
February 26, 2017 07:07
-
-
Save pawlos/f24814de9457f0947166845f1fccdfec to your computer and use it in GitHub Desktop.
Cognitive Services usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var client = new HttpClient(); | |
var queryString = HttpUtility.ParseQueryString(string.Empty); | |
// Request headers | |
client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", ConfigurationManager.AppSettings["VisionAPI"]); | |
queryString["visualFeatures"] = "Categories, Tags, Description, Faces, ImageType, Color, Adult"; | |
queryString["details"] = "Celebrities"; | |
queryString["language"] = "en"; | |
var uri = "https://westus.api.cognitive.microsoft.com/vision/v1.0/analyze?" + queryString; | |
HttpResponseMessage response; | |
using (var content = new ByteArrayContent(data)) | |
{ | |
content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); | |
response = await client.PostAsync(uri, content); | |
} | |
return response; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment