简体   繁体   中英

Azure FormRecognizer from Python SDK fails with message "Specified model not found or not ready"

Trying to submit document for form recognizer created in form recognizer studio using python api. I have tested the form successfully in form recognizer studio.

 from azure.core.credentials import AzureKeyCredential
 from azure.ai.formrecognizer import FormRecognizerClient
    
 endpoint = "https://eastus.api.cognitive.microsoft.com/"
 credential = AzureKeyCredential("xxxxxxxxxxxxxxxxxxxxxxxx")
 form_recognizer_client = FormRecognizerClient(endpoint, credential)
    
 path = r"3FE5A953-22D4-4197-B262-E195C3A2CE9F.pdf"
 with open(path, 'rb') as f:
     blob = f.read()
 poller = form_recognizer_client.begin_recognize_custom_forms(model_id='mymodel', form=blob)
 result = poller.result()

get exception

 azure.core.exceptions.HttpResponseError: (1001) Specified model not found or not ready, Model Id: mymodel
 Code: 1001
 Message: Specified model not found or not ready, Model Id: mymodel

I have tried recreating the model with every version of the API available - (2021-9-30-preview, 2022-1-30-preview, 2020-6-30-preview) and still no luck. I am using version 3.1.2 on the sdk. I have tried on version 3.1.0 and 3.2.0b5 and still get the error.

What API version was the model built with in Form Recognizer Studio? If it is one of the preview API versions, then you need to use the DocumentAnalysisClient which was added in the beta SDK versions, such as 3.2.0b5. You can find a link to the sample to get a custom document analysis here . The async sample can be found here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM