static async System.Threading.Tasks.Task Processone(string[] args) { string name = "arnoldschwarzenegger"; // await uploadpicturesAsync(@"C:/Users/lorenzo/Pictures/arnold", name); //Console.WriteLine("Hello World!"); var faceapi = new FaceApiAzure(); var client = FaceApiAzure.Authenticate(FaceApiAzure.ENDPOINT, FaceApiAzure.SUBSCRIPTION_KEY); string personGroupId = "apifacegroup"; var groupcreated = await FaceApiAzure.CreateIfnotexistIFaceClient(client, personGroupId); Settings settings = new Settings(); var list = (await settings.getListFiles(name)).ToList(); var personFound = await FaceApiAzure.CreatePersonIfnotexist(client, name, personGroupId); // await PersonGroupSample.DeletePerson(client,personFound, personGroupId); await FaceApiAzure.FiltersUrlAsync(client, list, personFound, personGroupId); if (list.Count > 0) { await FaceApiAzure.AddGroup(client, list.ToList(), personFound, personGroupId); } }
public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log) { log.LogInformation("C# HTTP trigger function processed a request."); if (req.Method.Equals("POST", StringComparison.InvariantCultureIgnoreCase)) { try { var copy = await new faceapilogic().getUser(req.Body); var client = FaceApiAzure.Authenticate(FaceApiAzure.ENDPOINT, FaceApiAzure.SUBSCRIPTION_KEY); var resultados = await FaceApiAzure.IdentifyAsync(client, copy.dataUri, FaceApiAzure.personGroupId); return(new OkObjectResult(resultados)); } catch (Exception ex) { return(new StatusCodeResult(StatusCodes.Status500InternalServerError)); } } string name = req.Query["name"]; string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); dynamic data = JsonConvert.DeserializeObject(requestBody); name = name ?? data?.name; string responseMessage = string.IsNullOrEmpty(name) ? "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response." : $"Hello, {name}. This HTTP triggered function executed successfully."; return(new OkObjectResult(responseMessage)); }
static async System.Threading.Tasks.Task Main(string[] args) { var faceapi = new FaceApiAzure(); var client = FaceApiAzure.Authenticate(FaceApiAzure.ENDPOINT, FaceApiAzure.SUBSCRIPTION_KEY); string personGroupId = "apifacegroup"; await FaceApiAzure.Train(client, personGroupId); Console.ReadKey(); }