来自Azure Blob存储带有认知服务的呼叫图像的问题

发布于 2025-02-12 21:27:36 字数 760 浏览 0 评论 0 原文

我正在尝试使用Azure认知服务,这给我带来了一个错误:

“ valueError:内容类型无法自动进行自动检测,因为流无法读取/可搜索。请传递content_type关键字参数。 >

我的代码如下:

from azure.core.credentials import AzureKeyCredential
from azure.ai.formrecognizer import FormRecognizerClient

endpoint = "https://example.cognitiveservices.azure.com/"
key = "xxxxxxxxxxxxxxxxxxx820"

read_image_url = 'https://storage-example.blob.core.windows.net/ocr-demo/inputs/IMG_1618.jpg?sp=r&st=2022-06-30xxxxxx31Z&se=2023-0xxxxxx:31Z&spr=https&sv=xxxxx08&sr=b&sig=6xxxxxxxx'

form_recognizer_client = FormRecognizerClient(
   endpoint=endpoint, credential=AzureKeyCredential(key)
)

我不明白为什么会返回我,因为我直接从服务和图像中授予密钥。

你能给我任何线索,请给我什么问题?

提前致谢。

问候。

I am trying to use an azure cognitive service, which throws me an error:

"ValueError: Content type could not be auto-detected because the stream was not readable/seekable. Please pass the content_type keyword argument."

My code is the following:

from azure.core.credentials import AzureKeyCredential
from azure.ai.formrecognizer import FormRecognizerClient

endpoint = "https://example.cognitiveservices.azure.com/"
key = "xxxxxxxxxxxxxxxxxxx820"

read_image_url = 'https://storage-example.blob.core.windows.net/ocr-demo/inputs/IMG_1618.jpg?sp=r&st=2022-06-30xxxxxx31Z&se=2023-0xxxxxx:31Z&spr=https&sv=xxxxx08&sr=b&sig=6xxxxxxxx'

form_recognizer_client = FormRecognizerClient(
   endpoint=endpoint, credential=AzureKeyCredential(key)
)

I don't understand why that returns me since I grant the KEY directly from the service and the image as well.

Can you give me any clue please what could be my problem?

Thanks in advance.

Regards.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

み零 2025-02-19 21:27:36

要使用认知服务从BLOB存储中调用图像,我们可以实现认知搜索过程。我们需要实现 blob索引器。默认情况下,我们看不到 indexer 图像上的实现。但是所有图像都将嵌入到 .msg 文件中,并提取文件中的附件。

该提取将返回归一化字段。即使斑点包含图像,也将被忽略,直到我们执行 ai富集

导入数据向导,如下图所述。

结帐完整的 indexer 文档

To call image from the blob storage using cognitive services, we can implement Cognitive Search procedure. We need to implement Blob Indexer. By default we can't see implementation of indexer on images. But all the images will be embedded into .MSG file and extract the attachments in the file.

That extraction will return the normalized_images fields. Even though the blob contain images, that will be ignored until the we perform AI enrichment.

Import the data wizard like mentioned in the following image.

enter image description here

Checkout the complete indexer procedure from document

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文