Não estou conseguindo rodar a linha "analise_celebridades = client.analyze_image_by_domain("celebrities", url,"en")".
Segue o código:
!pip install azure-cognitiveservices-vision-computervision
from azure.cognitiveservices.vision.computervision import ComputerVisionClient
from msrest.authentication import CognitiveServicesCredentials
credenciais = CognitiveServicesCredentials("d24e62705a3a4e925c4ceb30e04b40f6")
client = ComputerVisionClient("https://cv-test-alura.cognitiveservices.azure.com/", credenciais)
client.api_version
'3.2'
from azure.cognitiveservices.vision.computervision.models import VisualFeatureTypes
url = "http://pbs.twimg.com/media/ECx6hK-WwAAPzeE.jpg"
analise_de_imagem = client.analyze_image(url, [VisualFeatureTypes.tags])
for tag in analise_de_imagem.tags:
print(tag)
{'additional_properties': {}, 'name': 'human face', 'confidence': 0.9983632564544678, 'hint': None}
{'additional_properties': {}, 'name': 'person', 'confidence': 0.9910241365432739, 'hint': None}
{'additional_properties': {}, 'name': 'clothing', 'confidence': 0.9850200414657593, 'hint': None}
{'additional_properties': {}, 'name': 'nightclub', 'confidence': 0.9796069264411926, 'hint': None}
{'additional_properties': {}, 'name': 'smile', 'confidence': 0.9596958160400391, 'hint': None}
{'additional_properties': {}, 'name': 'magenta', 'confidence': 0.9069244265556335, 'hint': None}
{'additional_properties': {}, 'name': 'disco', 'confidence': 0.8865774273872375, 'hint': None}
{'additional_properties': {}, 'name': 'purple', 'confidence': 0.8797036409378052, 'hint': None}
{'additional_properties': {}, 'name': 'violet', 'confidence': 0.8554173111915588, 'hint': None}
{'additional_properties': {}, 'name': 'indoor', 'confidence': 0.6854885220527649, 'hint': None}
{'additional_properties': {}, 'name': 'woman', 'confidence': 0.5566776394844055, 'hint': None}
analise_celebridades = client.analyze_image_by_domain("celebrities", url,"en")
Esse é o erro que está aparecendo:
ComputerVisionErrorResponseException Traceback (most recent call last)
<ipython-input-71-8455effbf10c> in <module>()
----> 1 analise_celebridades = client.analyze_image_by_domain("celebrities", url,"en")
/usr/local/lib/python3.7/dist-packages/azure/cognitiveservices/vision/computervision/operations/_computer_vision_client_operations.py in analyze_image_by_domain(self, model, url, language, model_version, custom_headers, raw, **operation_config)
422
423 if response.status_code not in [200]:
--> 424 raise models.ComputerVisionErrorResponseException(self._deserialize, response)
425
426 deserialized = None
ComputerVisionErrorResponseException: (InvalidRequest) Invalid request has been sent.
O que pode ser?