skillfed

surya-ocr

OCR, layout, reading order, and table recognition in 90+ languages.

surya-ocr v0.22.1 1.0M downloads/30d#4,482 on PyPI21,273
Permissive license Apache-2.0 Active released

What it is and what it does

Surya is a 650M-parameter vision-language model for document intelligence that runs layout analysis, OCR, table recognition, and reading-order detection through a unified inference interface. It supports over 90 languages and works on diverse document types (newspapers, forms, handwritten notes, corporate documents). The package wraps the model and manages an inference server (vllm on NVIDIA GPUs or llama.cpp on CPU/Apple Silicon), spawning it automatically on first use or attaching to an existing server via environment variable.

The package provides command-line tools (surya_ocr, surya_layout, surya_table) and a Python API (RecognitionPredictor, LayoutPredictor, TableRecPredictor) that all share a single SuryaInferenceManager instance. Output includes per-block text with bounding boxes, canonicalized layout labels, table structure (rows and columns), and reading order. It depends on torch, torchvision, transformers, huggingface-hub, and opencv-python-headless for model loading and image processing.

Use it for:

  • Extract structured text and layout from scanned documents or PDFs for downstream NLP or database ingestion.
  • Automatically detect and extract tables from documents, preserving row/column structure.
  • Determine reading order and logical flow in complex multi-column or multi-element layouts.
  • Process multilingual documents (90+ languages) with a single model, avoiding language-specific OCR pipelines.
  • Build document classification or content-routing systems that depend on layout and content type detection.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Surya is an OCR and document intelligence model that extracts text, detects layout elements, recognizes tables, and determines reading order from images and PDFs in over 90 languages.

Yes, with conditions. Surya is actively maintained, popular, and offers strong multilingual OCR and layout analysis in a single model. Install it if you need document intelligence beyond basic text extraction and can provision the external inference backend (Docker+GPU or llama.cpp). If you lack GPU access or cannot run a separate inference server, the CPU path via llama.cpp may be slow. Commercial use of model weights requires a separate license agreement for revenue above $5M.

Install

surya-ocr on PyPI

pip

pip install surya-ocr

uv

uv add surya-ocr

poetry

poetry add surya-ocr

Installing surya-ocr

Before you install

Low install friction with a pure Python wheel. Active maintenance (last commit 2026-07-23) and strong popularity (top 5000 PyPI, ~1M monthly downloads). However, the package requires either Docker + NVIDIA Container Toolkit (for GPU inference via vllm) or llama.cpp binary (for CPU/Apple Silicon), which are external system dependencies not managed by pip.

License in practice

Apache-2.0 licensed code permits commercial use. Model weights use a modified AI Pubs Open Rail-M license: free for research, personal use, and startups under $5M funding/revenue, but broader commercial licensing requires a separate agreement from the vendor.

Quickstart

pip install surya-ocr

from surya.inference import SuryaInferenceManager
from surya.recognition import RecognitionPredictor

manager = SuryaInferenceManager()
rec = RecognitionPredictor(manager)
predictions = rec([image])

Requires vllm (NVIDIA GPU with Docker + NVIDIA Container Toolkit) or llama.cpp binary (CPU/Apple Silicon) to be installed and available before first inference run.

Verify before relying

  • Actual throughput on typical hardware (description claims 5 pages/s on RTX 5090, a high-end GPU).
  • Whether the 83.3% accuracy on olmOCR-bench and 87.2% multilingual benchmark translate to production use cases.
  • Memory and disk footprint of the 650M parameter model and inference server.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (<4,>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 18 — beautifulsoup4, click, filelock, filetype, httpx, huggingface-hub, openai, opencv-python-headless, pillow, platformdirs, pydantic-settings, pydantic, pypdfium2, python-dotenv, requests, torch, torchvision, transformers
Maintenance actively maintained — 25 days since the last release
Last repo commit
First released
Downloads 1,024,939/month — #4,482 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: surya_ocr-0.22.1-py3-none-any.whl

Keywords: ocr, pdf, tables, text detection, text recognition

Tags

ocr text extractiondocument layout analysistable recognition pdfmultilingual text detectionreading order detectionpdf text extractiondocument intelligence
document-intelligencemultilingual-ocrtable-extraction

More Artificial Intelligence packages