Advertisement
sandunfx

Untitled

Feb 11th, 2020
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.21 KB | None | 0 0
  1. using Flurl;
  2. using Flurl.Http;
  3. using Newtonsoft.Json;
  4. using Newtonsoft.Json.Linq;
  5.  
  6.       byte[] image = ImagePro.GetImageAsByteArray(txtIdentifyImagePath.Text);
  7.             ByteArrayContent content = new ByteArrayContent(image);
  8.  
  9.             List<dynamic> response = Settings.UriBase
  10.                                      .AppendPathSegment("detect")
  11.                                      .SetQueryParams(new
  12.                                      {
  13.                                          returnFaceId = "true"
  14.                                      })
  15.                                      .WithHeader("Ocp-Apim-Subscription-Key", Settings.SubscriptionKey)
  16.                                      .WithHeader("Content-Type", "application/octet-stream")
  17.                                      .PostAsync(content)
  18.                                      .ReceiveJson<List<dynamic>>()
  19.                                      .Result;
  20.  
  21.  
  22.             foreach (var item in response)
  23.             {
  24.                 txtIdentify.AppendText(((JObject)item).ToString() + Environment.NewLine);
  25.                 txtIdentify.AppendText("---------------" + Environment.NewLine);
  26.             }
  27.  
  28. SubscriptionKey-14359e73027d412b96806b7ebf50dabc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement