azure.core.exceptions.ResourceNotFoundError:(404)找不到资源

问题描述 投票:0回答:1

我是编程新手。 我在使用 AzureAIDocumentIntelligenceLoade 加载 DOCX、XLSX、PPTX 时遇到问题 我已经成功创建了Document Intelligence并获得了“端点”和“密钥”。 然而,当我尝试在Python环境中通过langchain_community加载xlsx文档时,我的电脑报告如下:

azure.core.exceptions.ResourceNotFoundError: (404) Resource not found Code: 404 Message: Resource not found

这是我的代码片段:

`file = "D:/Python/xuexisucai/LLM/Coffe list.xlsx"
endpoint = "https://xxxxx.cognitiveservices.azure.com/"
key = "123456"
loader = AzureAIDocumentIntelligenceLoader(
api_endpoint= endpoint, api_key= key, file_path=file, api_model= "prebuilt-layout"
)
documents = loader.load()`

哪位高手可以来帮助一下这个新手?

langchain azure-form-recognizer microsoft-azure-documentdb
1个回答
0
投票
  • 由于详细信息

    Endpoint
    Key和文档路径无效而发生错误ResourceNotFoundError

  • 根据Document,文档智能布局模型支持分析 XLSX 文件,确保准确提取文本、表格、图形和层次结构。

  • XLSX 文档可以使用此模型进行有效处理,需要清晰的照片或高质量的扫描以获得最佳结果。 enter image description here

  • 开发选项包括利用 Document Intelligence Studio、REST API 和 SDK。

  • 输出组件包括段落,其中提取标题、章节标题和脚注等文本块,以及表格,解析表格以确定列和行信息。

enter image description here

  • 检测图表和图像等图形,并识别文档中的部分,有助于组织和理解。此外,该模型可以以 Markdown 格式输出提取的文本,从而促进与基于 Markdown 的工作流程的集成。

from azure.core.credentials import AzureKeyCredential
from azure.ai.documentintelligence import DocumentIntelligenceClient
from azure.ai.documentintelligence.models import AnalyzeResult

endpoint = "DOCUMENTINTELLIGENCE_ENDPOINT"
key = "DOCUMENTINTELLIGENCE_API_KEY"

document_intelligence_client = DocumentIntelligenceClient(endpoint=endpoint, credential=AzureKeyCredential(key))

# Path to your XLSX file
path_to_xlsx_file = "C://Users//file_example_XLSX_101.xlsx"

# Open the XLSX file as a binary read mode
with open(path_to_xlsx_file, "rb") as f:
    poller = document_intelligence_client.begin_analyze_document(
        "prebuilt-layout", analyze_request=f, content_type="application/octet-stream"
    )
    result: AnalyzeResult = poller.result()

    # Process the analysis result
    for page in result.pages:
        print(f"----Analyzing layout from page #{page.page_number}----")
        print(f"Page has Pageitems: {page.items} and page_number: {page.page_number}, ")

    

输出: enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.