How to use the latest model version for Vision OCR on Python?

Danny Zhang 20 Reputation points
2024-09-01T19:10:29.7966667+00:00

When I am using the ImageAnalysisClient in my code to analyze an image and return text, the API only seem to use the 2023-10-01 model version. How can I use 2024 or later version of the Vision OCR?

Here is my current code:

 client = ImageAnalysisClient(
        endpoint=endpoint,
        credential=AzureKeyCredential(key)
    )
    try:
        with open(img_path, "rb") as f:
            image_data = f.read()
    except:
        print(f"The file '{img_path}' does not exist.")
        return None
    
    print(f"Analyzing '{img_path}'")
    result = client.analyze(
        image_data=image_data,
        visual_features=[VisualFeatures.READ],
        model_version='latest'
    )
Azure Computer Vision
Azure Computer Vision
An Azure artificial intelligence service that analyzes content in images and video.
366 questions
{count} votes

Accepted answer
  1. navba-MSFT 23,625 Reputation points Microsoft Employee
    2024-09-11T04:50:59.64+00:00

    @Danny Zhang I had a discussion with the Product Owners internally. The below is a documentation bug and they will fix it.

    User's image

    The latest model version is 2023-10-01.

    Also note that the api-version and model-version used by Vision Studio is 2023-10-01.

    If you want to use api-version: 2024-02-01 you can go ahead with using this. But be aware that the model-version will be shows as 2023-10-01. This is by design and expected.

    Hope this answers.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.