A newer version of the Gradio SDK is available: 6.20.0
title: OCR & Document AI (PaddleOCR + EasyOCR)
emoji: 🧾
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: 5.0.0
app_file: app.py
pinned: false
OCR & Document AI Pipeline (PaddleOCR + EasyOCR)
A production-flavored OCR pipeline for images and PDFs.
It rasterizes PDFs to images (via PyMuPDF), performs OCR with PaddleOCR (high-quality, multilingual) or EasyOCR (lightweight fallback), and returns structured JSON (bounding boxes, text, confidence). Includes a web demo with image/PDF previews and JSON download.
Ethics note: Process only documents you own or are authorized to use. Handle sensitive data responsibly.
Features
- Images and PDFs (page rendering via PyMuPDF)
- OCR with PaddleOCR (multilingual, high-quality) or EasyOCR (fallback)
- Clean JSON schema per text block (page, bbox, text, confidence)
- Gradio demo with image preview, PDF first-page preview, and JSON export
- CLI for batch jobs (local use)
Quickstart (Local)
- Create & activate a virtual environment
macOS / Linux: python3 -m venv .venv source .venv/bin/activate
Windows PowerShell: python -m venv .venv ..venv\Scripts\Activate.ps1
Install dependencies pip install --upgrade pip pip install -r requirements.txt
Try the CLI
Add a sample image or PDF into examples/input/
python -m ocrpkg.core examples/input examples/output --lang en
- Run the demo python app.py
Open the local URL in your browser, upload a file, and download results.
Output Format
Each OCR block (JSON): { "page": 1, "bbox": [100, 200, 250, 240], "text": "Invoice #1234", "confidence": 0.92 }
Tech Stack
- PaddleOCR (primary OCR engine)
- EasyOCR (fallback engine)
- PyMuPDF (PDF rendering)
- OpenCV + Pillow (preprocessing)
- Pydantic (schema)
- Gradio (demo UI)
- Click (CLI)
License
MIT License. Respect the license of third-party models and libraries.