Closed JingjingShii closed 3 years ago
Some sites block anonymous agent access.
The landmark command of the git repository gjwgit/azcv needs to be updated to set the User Agent to be Mozilla/5.0 as is done in mlhub/utils.py and mlhub/commands.py.
This is a general issue and perhaps we need a general mlhub function to download a file from a URL after setting the User Agent appropriately.
After the value error is fixed in the type function, the result of ml type azcv https://bit.ly/3bNGSB
is Image URL is not accessible
as well.
Some bit.ly short links work just fine. But not this one:
$ ml landmarks azcv https://bit.ly/3vnuG24
Traceback (most recent call last):
File "landmarks.py", line 64, in <module>
analysis = client.analyze_image_by_domain(domain, url, language)
File "/home/gjw/.local/lib/python3.8/site-packages/azure/cognitiveservices/vision/computervision/operations/_computer_vision_client_operations.py", line 400, in analyze_image_by_domain
raise models.ComputerVisionErrorException(self._deserialize, response)
azure.cognitiveservices.vision.computervision.models._models_py3.ComputerVisionErrorException: Image URL is not accessible.
This one works just fine:
$ ml landmarks azcv https://bit.ly/3lfNVG6
0.94,Colosseum
Is it the final server where the image actually is is rejecting the short link? A wget
works just fine.
Close this now - It is Azure calling through to the end image site via the bitly link. Somewhere along the way it is being blocked.
Note that locally the following works just fine:
$ wget https://bit.ly/3vnuG24 -O tmp.png
When trying to run
ml landmarks azcv https://bit.ly/3vnuG24
under azcv package (this command line is found in chapter 6.3 https://mlhub.ai/survivor/azcv-quick-start.html), I got the error: