Closed MaurusGubser closed 1 year ago
@MaurusGubser Thanks for your feedback! We will investigate and update as appropriate.
@MaurusGubser
It seems like there is a connection issue with the Azure service. You can try the following steps to troubleshoot the issue:
For an issue like this, I'd recommend you create a support ticket since the support team will be able to respond much more quickly and have a conversation with you to figure out what could be going on.
@MaurusGubser We are going to close this thread, if there are any further questions regarding the documentation, please tag me in your reply and we will be happy to continue the conversation.
@RamanathanChinnappan-MSFT Thanks for your answer and suggestions. So far, I still could not figure out what the exact problem is. However, I managed to run the quickstart.py
script in a Debian 11 VM on my machine. I suspect your point 3 might be the problem, but so far, I did not manage to run the quickstart.py
script on my machine. I will update this issue, when I find out more.
@Naveenommi-MSFT
I have the same problem here.
I was able to run the quickstart.py
script by installing a complete Anaconda environment, so I don't think it is firewall or keys related.
It is very strange...
@MaurusGubser Thanks for your feedback. I suspect this could be a doc-bug. I am going to assign this case to content author who will update the document accordingly.
@YashikaTyagii I start to suspect it has something to do with the azure-ai-vision
library.
I have removed the lib and wrote this (quick and dirty) code, and everything works:
def azure_image_desc(image_url):
import requests
url = f"{azure_endpoint}/computervision/imageanalysis:analyze?features=caption,read&model-version=latest&language=en&api-version=2023-02-01-preview"
headers = {
"Ocp-Apim-Subscription-Key": azure_subscription_key,
"Content-Type": "application/json"
}
data = {
"url": image_url
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 200:
data = response.json()
return data['captionResult']['text']
else:
return response.text
My Settings:
I second that. I wrote a similar script on my Ubuntu 22.04 machine using the request
library, which works:
import json
import os
import requests
import numpy as np
from dotenv import load_dotenv
load_dotenv()
endpoint = os.getenv("VISION_ENDPOINT")
key = os.getenv("VISION_KEY")
headers = {
# Request headers
"Ocp-Apim-Subscription-Key": key,
"Content-Type": "application/octet-stream",
}
features = "read"
model_version = "latest"
language = "en"
api_version = "2023-02-01-preview"
img_path = "/path/to/my/file.jpg"
with open(img_path, "rb") as img_stream:
res = requests.post(
url=f"{endpoint}computervision/imageanalysis:analyze?features={features}&model-version={model_version}&language={language}&api-version={api_version}",
headers=headers,
data=img_stream)
print(f"Status code {res.status_code}, reason: {res.reason}")
Also, as already written above, when I use curl from the command line, it also works.
@YashikaTyagii I did some other tests. On a HP Elite Desk (Intel Core i5-4590T CPU@2.00GHz) I installed a dual boot with Windows10 Pro and Ubuntu 22.04 LTS. On the Windows 10, the quickstart.py
was running, on Ubuntu 22.04, I had the same troubles as on my Ubuntu machine.
Also have this issue (running on Amazon linux)
Thank you, we have an SDK installation doc coming soon that will provide more detail on which varieties of Linux can work with which SDKs
Also have this issue running on CentOS 7.9.2009 x86_64(Py3.8)
for those landing here, this should be the issue https://github.com/Azure-Samples/azure-ai-vision-sdk/issues/40#issuecomment-1638669858
I tried out the Quickstart: Image Analysis 4.0 on an Ubuntu 22.04 machine. The script
quickstart.py
fails with the error message:
I did set the endpoint and key variable correctly; the same script, with corresponding endpoint and key variable works on a windows 10 machine. Also, when working from the command line and using curl
the microsoft cognitive service works on my Linux machine.
My setting:
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.