Programming languages: Quick start with OCR SDK for Python

Use our code sample in Python to get your application which uses Cloud OCR SDK up and running.

Prerequisites to using the sample are:

  • Python 2 or 3 installed on the workstation (the sample was tested on versions 2.7 and 3.6).
  • Application ID and Password, which can be received through an account with ABBYY Cloud OCR SDK. If you do not have one, register here.

Now you are ready to start. Perform the following steps:

  1. Download and unzip the sample.
  2. Go to the sample folder and run the following command line to install the required packages:
    pip install -r requirements.txt
  3. Customize the URL for HTML requests. To do this open the "" file and set the ServerUrl property to the appropriate value according to the location center. For example, for processing data in Europe, set the URL as following:
    ServerUrl = ""
  4. Set the environment variables: ABBYY_APPID to your Application ID, ABBYY_PWD to the Application Password. The processing server requires the Application ID and Password for each request. More details can be found in Authentication.
    On Windows operating system, this is done with the following commands:
    set ABBYY_APPID=YourApplicationId
    set ABBYY_PWD=YourPassword
    On Linux operating system, use these commands:
    export ABBYY_APPID=YourApplicationId
    export ABBYY_PWD=YourPassword
  5. Run image recognition:
    python "image.jpg" result.txt
    This is what you will see as a result:
    Running the Python sample
  6. By default, the sample is configured to recognize documents in English and export them to plain text format (TXT). Other languages and settings are available through command-ine options. To see the possible options, run
    python -h
    Python sample help screen
  7. Change the code of the sample to integrate OCR with other functionality your application will provide and create the best solution for your scenario.

The basics of using Cloud OCR SDK are explained in How to Work with Cloud OCR SDK, and detailed information on the processing and service methods is given in API Reference.

Have more questions? Submit a request



Please sign in to leave a comment.