I have Trained a custom classification model successfully

Ashith Bhandary 0 Reputation points
2024-04-02T08:33:39.4866667+00:00

I have trained Custom Model for Classification using Form Recogniser Studio. The model is trained successfully, now I need to consume the model using a python script.

I looked in the sdk documentation, I could not find an API that facilities consumption of Custom Classification Model, please help.

i have used this code to perform inferencing of

from azure.core.credentials import AzureKeyCredential
from azure.ai.formrecognizer import DocumentAnalysisClient
endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
classifier_id = os.getenv("CLASSIFIER_ID", classifier_id)
document_analysis_client = DocumentAnalysisClient(
    endpoint=endpoint, credential=AzureKeyCredential(key)
)
with open(path_to_sample_documents, "rb") as f:
    poller = document_analysis_client.begin_analyze_document
(
        model_id = model_id, document=f
    )
result = poller.result()
print("----Classified documents----")

But i get this error

ResourceNotFoundError: (404) Resource not found Code: 404 Message: Resource not found

I looked in the sdk documentation, I could not find an API that facilities consumption of Custom Classification Model, please help.

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

1 answer

Sort by: Most helpful
  1. dupammi 5,735 Reputation points Microsoft Vendor
    2024-04-02T13:15:13.3833333+00:00

    Hi @Ashith Bhandary ,

    Please check the classify_document_from_url and begin_classify_document() methods in the version of the SDK 3.3.2since this is equivalent to custom classification model of FR, please check by installing this version and try again.

    There are several examples on the GitHub repo to analyze documents with the prebuilt or custom models.

    For SDK reference, please use this link and select the required SDK version to lookup the reference.

    I hope this helps!!


    If this answers your query, do click Accept Answer and Yes for was this answer helpful.

    0 comments No comments