How rahid-khan/fast-api-ocr works
Unlimited OCR is a browser-based document digitizer: users upload PDFs or images, follow job progress and streamed OCR text, then view or download results in text, Markdown, or JSON. The API validates and records uploads, schedules processing, converts PDF pages, and invokes the OCR engine; job records and results support history and status queries. The dashboard presents GPU, memory, and inference statistics. The README documents these capabilities; sampled backend and frontend excerpts support the principal wiring, while some dashboard and progress endpoints are represented only by their enclosing router paths.
Main entry points: app.js Upload and dashboard · job_manager.py Job orchestration · ocr_engine.py OCR engine · jobs.py Jobs API and SSE
Components 17
Browser interface
- Web application
static/index.html - Upload and dashboard
static/js/app.js - Results and history
static/js/result-viewer.js - Dashboard charts
static/js/visualization.js
API and jobs
- FastAPI application
app/main.py - Upload endpoint
app/routers/upload.py - Jobs API and SSE
app/routers/jobs.py - Job orchestration
app/job_manager.py - Health and metrics API
app/routers/health.py - Job response schemas
app/models.py
OCR processing
- PDF page conversion
app/pdf_converter.py - OCR engine
app/ocr_engine.py
State and monitoring
- SQLite job records
app/database.py - Uploaded and result files
Other components
- Document user
- Unlimited-OCR model
- GPU or CPU
Connections 29
- Document user → Web application: uses
- FastAPI application → Web application: serves
- Web application → Upload and dashboard: loads
- Upload and dashboard → Upload endpoint: uploads file
- Upload and dashboard → Jobs API and SSE: requests jobs
- Upload and dashboard → Health and metrics API: requests metrics
- Jobs API and SSE → Results and history: returns results
- Results and history → Upload and dashboard: renders history
- Upload and dashboard → Dashboard charts: renders metrics
- FastAPI application → Upload endpoint: mounts route
- FastAPI application → Jobs API and SSE: mounts route
- FastAPI application → Health and metrics API: mounts route
- FastAPI application → SQLite job records: initializes
- Upload endpoint → Uploaded and result files: saves upload
- Upload endpoint → Job orchestration: creates and schedules
- Upload endpoint → Job response schemas: returns job
- Job orchestration → SQLite job records: reads and updates
- Job orchestration → PDF page conversion: converts PDFs
- Job orchestration → OCR engine: runs OCR
- Job orchestration → Uploaded and result files: stores outputs
- PDF page conversion → Uploaded and result files: writes page images
- OCR engine → Unlimited-OCR model: runs inference
- OCR engine → GPU or CPU: uses when available
- OCR engine → Uploaded and result files: reads and writes outputs
- OCR engine → Jobs API and SSE: provides stream chunks
- Jobs API and SSE → SQLite job records: queries and deletes
- Jobs API and SSE → Job orchestration: deletes job files
- Health and metrics API → OCR engine: reads runtime metrics
- Health and metrics API → SQLite job records: reads job statistics