Ejemplo n.º 1
0
        public async Task <IActionResult> UploadAsync(FaceTrainingViewModel model)
        {
            if (ModelState.IsValid)
            {
                var imageList = ImageExtensions.GetAllUploadedImages(model.Files);
                await _faceAnalysisService.CreateAPersonGroupAsync(_azureSettings.Value.CognitiveServicesFaceApiGroupId, model.FaceName);

                await _faceAnalysisService.AddPersonToPersonGroupAsync(_azureSettings.Value.CognitiveServicesFaceApiGroupId, model.FaceName, imageList);

                await _faceAnalysisService.TrainPersonGroupAsync(_azureSettings.Value.CognitiveServicesFaceApiGroupId);
            }
            else
            {
                return(RedirectToActionPermanent(nameof(Index), "FaceAnalysis"));
            }

            return(RedirectToActionPermanent(nameof(Index), "Home"));
        }