How to start analyze document using local container v2.1 model when we received server response 200 notStarted error when analyzing document

MUHAMMAD NAQIUDDIN 5 Reputation points
2023-05-30T07:52:36.7733333+00:00

We have tried to analyze document using custom model created using POST request from local container v2.1 run using docker in a VM.

We have received server response 200 which indicates that the response succeed in analyze, however we receive response shown as notStarted.

We would like to know on how to start analyze document through model created through local container v2.1

Azure AI Document Intelligence
Azure AI Document Intelligence
An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
1,526 questions
{count} votes

1 answer

Sort by: Most helpful
  1. VasimTamboli 4,780 Reputation points
    2023-05-31T09:32:43.5666667+00:00

    @MUHAMMAD NAQIUDDIN

    it means that the analysis process has been accepted, but it hasn't started yet or is still in progress. In this case, you need to wait for the analysis to complete before retrieving the results.

    To start the analysis process and retrieve the results using the local container v2.1, you can follow these steps:

    Make sure the Form Recognizer container is running and accessible in your VM. You can check the container status using the docker ps command.

    Use the POST /formrecognizer/v2.1/custom/models/{modelId}/analyze API endpoint to submit the document for analysis. Replace {modelId} with the ID of your custom model.

    Here's an example using cURL:

    bashCopy code
    curl -X POST -H "Content-Type: application/pdf" --data-binary @<path_to_document> "http://localhost:5000/formrecognizer/v2.1/custom/models/{modelId}/analyze"
    

    Replace <path_to_document> with the path to your document file.

    Note: Make sure to set the Content-Type header to the appropriate value based on your document type (e.g., application/pdf for PDF files).

    After submitting the document for analysis, you will receive a 202 Accepted response with a Location header in the response. The Location header contains the URL to check the status of the analysis.

    Use the GET request on the URL provided in the Location header to check the analysis status. You can use the curl command again, this time with a GET request:

    bashCopy code
    curl -X GET "http://localhost:5000/<analyzeUrl>"
    

    Replace <analyzeUrl> with the URL from the Location header.

    Check the response to see if the analysis has completed. If the status is still "notStarted" or "running," it means the analysis is still in progress. You need to wait and check the status again until it changes to "succeeded" or "failed."

    Once the analysis is complete and the status is "succeeded," you can retrieve the results using the GET /formrecognizer/v2.1/custom/models/{modelId}/analyzeResults/{analyzeResultId} API endpoint.

    Here's an example using cURL:

    bashCopy code
    curl -X GET "http://localhost:5000/formrecognizer/v2.1/custom/models/{modelId}/analyzeResults/{analyzeResultId}"
    

    Replace {modelId} with the ID of your custom model, and {analyzeResultId} with the ID of the analyze result.

    By following these steps, you can start the document analysis process using a local container v2.1 and retrieve the results once the analysis is complete.

    0 comments No comments