Surya OCR is a Python library offering state-of-the-art optical character recognition (OCR), document layout analysis, reading order detection, and table recognition for over 90 languages. It's built on deep learning models, providing high accuracy for complex document structures. The current version is 0.17.1, and it undergoes active development with frequent releases.
pip install surya-ocrVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the Surya OCR model and perform OCR on a dummy image. The `SuryaOCR.create_model()` call will automatically download the necessary deep learning models on its first execution. It performs detection, recognition, and layout analysis to return structured text and bounding boxes. Ensure you have `pillow` installed for image handling.
Thoroughly test existing code against the new version. Consult release notes and documentation for any API or output changes related to layout analysis. Retrain or re-evaluate any custom post-processing logic.
Install `surya-ocr[gpu]` if you have a CUDA-enabled GPU and ensure your CUDA toolkit is correctly set up. Verify `onnxruntime-gpu` is indeed being utilized (e.g., by monitoring GPU usage).
Ensure an active internet connection during the first run. For production environments or air-gapped systems, consider pre-downloading and packaging models if the library supports it (check advanced documentation) or running an initial setup script in a connected environment.
Ensure your Python environment is within the specified range. Use tools like `pyenv` or `conda` to manage multiple Python versions if needed.