A lightweight and async OCR server powered by FastAPI, Celery, EasyOCR, and Redis. Supports image and PDF OCR using CPU.
- OCR for images (
.jpg,.png, etc.) and PDFs - Async task processing with Celery
- Accurate OCR using EasyOCR
- Task-based API (submit → get result)
- Modular codebase (production-ready)
ocr-server/
├── Dockerfile
├── docker-compose.yml
├── requirements.txt
├── src/
│ ├── __main__.py # FastAPI app entrypoint
│ ├── worker.py # Celery worker app
│ ├── tasks.py # Celery OCR task
│ ├── ocr_engine.py # EasyOCR logic
│ ├── utils.py # PDF/Image tools
│ └── config.py # Paths & settings- Docker & Docker Compose
docker-compose up --buildSubmit OCR task
POST /ocr
Form-Data: file=@yourfile.pdfGet result
GET /result/{task_id}{
"status": "completed",
"result": {
"type": "pdf",
"pages": [
{
"page": 1,
"text": [
{
"text": "Hello World",
"confidence": 0.98,
"box": [[x1, y1], [x2, y2], ...]
}
]
}
]
}
}curl -F "file=@sample.pdf" http://localhost:8000/ocr
curl http://localhost:8000/result/<task_id>