Open-Source OCR Service
A self-hosted FastAPI service that turns images and multi-page PDFs into page-level text using Unlimited-OCR on an NVIDIA GPU.
Timeline
Developed through iterations on GPU serving, PDF support, authentication, and extraction controls.
Role & Scope
Implemented upload validation, PDF rasterization, model integration, page-level responses, and container deployment.
Team Setup
Open-source service maintained in a public GitHub repository.
Context
Problem: Document pipelines needed local OCR with predictable API responses and controls for GPU memory, long outputs, and invalid uploads.
Solution: Wrapped Unlimited-OCR in two upload endpoints: a base mode for accurate extraction and a crop-based long-document mode with optional repetition control.
Impact: Provides reusable PDF and image extraction with page-level results, processing times, and local model inference.
Implementation Details
Architecture
FastAPI loads baidu/Unlimited-OCR at startup. PyMuPDF rasterizes PDFs; base and long modes configure inference resolution and cropping. An inference lock serializes GPU work, and temporary directories isolate request files.
Data & Evaluation
Responses expose page text and elapsed time for inspection. No aggregate accuracy or latency benchmark is published; the configured Arabic workflow intentionally skips or redacts Quranic verse regions.
Production & Ops
Docker targets CUDA 12.8. The API includes optional bearer authentication, upload and page limits, per-page timeouts, GPU health reporting, and request IDs for tracing errors.
Lessons Learned
GPU memory limits, repeated generation, and PDF preprocessing need explicit handling to make OCR useful inside a larger pipeline.
Links
Last verified: October 18, 2026
Public Evidence
Last verified: October 18, 2026