Exemple #1
0
        public async Task <ActionResult <ImageClassificationResponseDTO> > Classify(ImageClassificationRequestDTO request)
        {
            var service = new GoogleService();
            var classificationService      = new ClassificationService();
            ImageRecognitionRequestDTO dto = new ImageRecognitionRequestDTO(new Image(request.Base64));

            dto.Features.Add(new Feature("LABEL_DETECTION"));
            dto.Features.Add(new Feature("IMAGE_PROPERTIES"));
            var requestDto = new GoogleVisionRequest();

            requestDto.Requests.Add(dto);
            var visionDto = await service.GetGoogleVisionResponseAsync(requestDto);

            return(classificationService.ConvertToClassificationDto(visionDto));
        }