Skip to main content

Aspose OCR Cloud 5.0 API

Project description

Aspose.OCR Cloud for Python SDK 23.12.0

PyPI PyPI - Format PyPI - Downloads GitHub license GitHub last commit

Aspose.OCR Cloud is an optical character recognition as a service. With it, you can easily add OCR functionality to almost any device or platform, including netbooks, mini PCs, or even entry-level smartphones.

Our engine can read text from images, photos, screenshots and scanned PDFs in a wide variety of European, Cyrillic and Oriental fonts, returning results in the most popular document formats. Powerful built-in image processing filters based on neural networks automatically correct skewed and distorted images, automatically remove dirt, smudges, scratches, glare and other image defects that can affect recognition accuracy. To further improve the results, Aspose.OCR Cloud has a built-in spell checker that automatically replaces misspelled words and saves you the trouble of manually correcting the recognition results.

Even the complex recognition tasks can be done with a couple of API calls. To make interacting with Aspose.OCR Cloud services from Python applications even easier, we provide the software development kit (SDK) for Python. It handles all the routine operations such as establishing connections, sending API requests, and parsing responses, wrapping all these tasks into a few simple classes.

Aspose.OCR Cloud SDK for Python is open source under the MIT license. You can freely use it for any projects, including commercial and proprietary applications, as well as modify any part of its code.

Try Online

Image to Text Image to Searchable PDF PDF OCR Receipt Scanner
Scan Image Image to Searchable PDF PDF OCR Receipt Scanner

What was changed in version 23.12.0

A summary of recent changes, enhancements and bug fixes in Aspose.OCR Cloud SDK for Python 23.12.0 release:

Key Summary Category
OCR‑3737 Added a free API for evaluating image recognition without authorization.
Some restrictions apply. See below for details.
New feature

Public API changes and backwards compatibility

This section lists all public API changes introduced in Aspose.OCR Cloud SDK for Python 23.12.0 that may affect the code of existing applications.

Added public APIs:

The following public APIs have been introduced in this release:

Image recognition evaluation

The following new classes have been added:

Class Description
RecognizeImageTrialApi Image recognition API that works without authorization.

Important: In recognition results, 10% of the words are substituted with asterisks (*). The sequence of masked words remains unchanged upon re-submitting the identical image for recognition.

Learn more...

Updated public APIs:

No changes

Removed public APIs:

No changes.

Quickstart

Make your solution using SDK, follow these steps:

1. Get API keys if you haven't

Make a personal account on Aspose Cloud Dashboard and click Get Keys. These keys are useful for all Aspose Cloud products. If you have any trouble, look at this detailed manual.

2. Run Demo

  • Checkout the SDK or get from pip (pip install aspose-ocr-cloud)
  • Set Your AppSid & AppKey
  • Run Python console Demo


OCR in Python

# Get your ClientId and ClientSecret from https://dashboard.aspose.cloud (free registration required).

	
    with aspose_ocr_cloud.ApiClient(config) as api_client:
        # Create an instance of the API class
        api_instance = recognize_image_api.RecognizeImageApi(api_client)

        # Read image file and conver it into base64 string
        image_file_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../samples/latin.png')

        # Create request body
        body = OCRRecognizeImageBody(
            image=utils.file_to_base64(image_file_path),
            settings=OCRSettingsRecognizeImage(
                language=Language("English"),
                makeSkewCorrect=False,
                makeBinarization=False,
                makeSpellCheck=False,
                makeContrastCorrection=False,
                makeUpsampling=False,
                dsrMode=DsrMode("NoDsrNoFilter"),
                dsrConfidence=DsrConfidence("Default"),
                resultType=ResultType("Text")
            ),
        )
        try:
            # Step 1: perform post request
            task_id_response = api_instance.post_recognize_image(
                body=body,
            )
            task_id = task_id_response.body
            print(f'Your task ID is {task_id}')

            # Step 2: perform get result request
            task_response : OCRResponse = api_instance.get_recognize_image(
                query_params={'id':task_id}
            )
            assert task_response.response.status == 200
            assert task_response.body['taskStatus'] == 'Completed'
            recognized_text_raw = task_response.body['results'][0]['data']
            recognized_text = bytearray(base64.b64decode(str(recognized_text_raw))).decode('utf-8')
            print (f'Recognized text:
{recognized_text}')
            print (f'Task completed.Press Enter to continue')
            input()

        except aspose_ocr_cloud.ApiException as e:
            print("Exception when calling RecognizeImageApi: %s
" % e)

Structure

This project includes:

  • Python console demo application - "./example"
  • Module "asposeocrcloud" - this is SDK located in "./asposeocrcloud". You can integrate it in your application.
  • Module "test" - "./test" UnitTest. You can take a look at them to see various code examples.
  • Folder "docs" - "./docs" Full documentation for Aspose.OCR SDK in HTML format.

Dependencies


Aspose.OCR Cloud SDKs

.NET & Core Java Python Node.js Android

Product Page | Documentation | API Reference | Code Samples | Blog | Free Support | Free Trial

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aspose-ocr-cloud-23.12.0.tar.gz (125.3 kB view hashes)

Uploaded Source

Built Distribution

aspose_ocr_cloud-23.12.0-py3-none-any.whl (374.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page