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:
- Download and unzip the sample.
- Go to the sample folder and run the following command line to install the required packages:
pip install -r requirements.txt
- 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
export ABBYY_APPID=YourApplicationId export ABBYY_PWD=YourPassword
- Run image recognition:
python process.py "image.jpg" result.txt
- 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 process.py -h
- Change the code of the sample to integrate OCR with other functionality your application will provide and create the best solution for your scenario.