static void Main(string[] args) { string groupId = "testpersongroup1"; var createPersonGroup = new PG { name = "group name #1", userData = "user-provided data attached to the person group.", recognitionModel = "recognition_02" }; // CreatePGRequest(groupId, createPersonGroup).Wait(); GetPGListRequest().Wait(); // CreatePersonRequest(groupId, new Person { name = "Andrey Ganyushkin", userData ="Developer"}).Wait(); // CreatePersonRequest(groupId, new Person { name = "Victor Nabatov", userData = "Guru" }).Wait(); Console.WriteLine("\n------------------ ListPersonRequest --------------------\n"); ListPersonRequest(groupId).Wait(); string location = @"E:\photos\VictorNabatov"; /*foreach (var fileName in Directory.GetFiles(location)) * { * Console.WriteLine($"{fileName}"); * AddFaceRequest(groupId, "663eeb9d-b9a2-49e9-8464-1446384761f3", Path.Combine(location, fileName)).Wait(); * }*/ Console.WriteLine("\n------------------ TRAIN --------------------\n"); //TrainRequest(groupId).Wait(); TrainStatusRequest(groupId).Wait(); }
static async Task CreatePGRequest(string pdId, PG createPersonGroup) { var client = new HttpClient(); var queryString = HttpUtility.ParseQueryString(string.Empty); client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", KEY); var uri = PREFIX + "/persongroups/" + pdId + "?" + queryString; HttpResponseMessage response; byte[] byteData = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(createPersonGroup)); using (var content = new ByteArrayContent(byteData)) { content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); response = await client.PutAsync(uri, content); string respBody = await response.Content.ReadAsStringAsync(); Console.WriteLine($"{respBody}"); } }