A high-performance OCR web API service powered by oar-ocr, compatible with the PaddleOCR Serving protocol.
- Text OCR — PP-OCRv6 small with word-level detection and confidence scoring
- Document Structure Analysis — Layout detection (PP-DocLayout_plus-L), table recognition (SLANet_plus), and formula recognition (PP-FormulaNet_plus-S)
- Chart Detection — Automatic identification of charts, flowcharts, and figure titles in documents
- Image URL Support — Accept image URLs (hotlinks) for OCR processing
- Token Authentication — Optional Bearer token authentication for API and web UI
- PaddleOCR Compatible — Drop-in replacement for PaddleOCR Serving API
- Web UI — Built-in drag-and-drop web interface with progress visualization
- Docker Support — Pre-bundled models with persistent volume, no download on first run
Windows builds are ideal for local testing and development — no Docker required.
- OS: Windows 10/11 64-bit
- No Rust, Docker, or dev tools required for the pre-built binary — everything works with PowerShell out of the box
- CPU note: The Windows ONNX Runtime prebuilts use AVX2 and require a modern desktop/laptop CPU. Older low-power CPUs (e.g. Celeron J4125/N5105, common in NAS devices) will crash — in that case use the Docker section below to build from source with AVX disabled
GitHub Releases ships a pre-compiled Windows executable — no Rust installation needed.
-
Download: grab
oar-ocr-web-v0.1.x-windows-amd64.zipfrom GitHub Releases -
Extract: unzip to any folder (e.g.
D:\oar-ocr-web) -
Download models: open PowerShell in the extracted folder and run:
powershell -ExecutionPolicy Bypass -File .\download_models.ps1
Or just double-click
download_models.ps1in Explorer (~30 seconds) -
Start: double-click
oar-ocr-web.exe. A black console window will show logs. -
Open browser: visit http://localhost:3000
See Configuration below for token auth, logging, etc.
-
Install Rust: go to https://rustup.rs/, download and run rustup (all defaults), then restart PowerShell
-
Clone:
git clone https://github.com/tabortao/oar-ocr-web.git cd oar-ocr-web
-
Download models:
.\download_models.ps1
-
Configure (optional):
copy .env.example .env notepad .env
-
Build & run:
cargo run --releaseFirst build takes ~5–10 minutes (downloads deps + compiles). Incremental builds are fast.
All settings are environment variables or entries in .env:
| Variable | Default | Description |
|---|---|---|
TOKEN |
empty (auth disabled) | API Bearer token — leave empty to skip auth |
PORT |
3000 | Web service port |
OAR_HOME |
models/ next to the exe |
Model file directory |
LOG_DIR |
./logs |
OCR request log directory |
LOG_RETENTION_DAYS |
30 | Auto-delete logs older than N days |
Temporary (current PowerShell window only):
$env:TOKEN = "my-secret-token"
$env:PORT = "8080"
.\oar-ocr-web.exePersistent (works for both Option 1 and Option 2, put in .env):
TOKEN=my-secret-token
PORT=8080
OAR_HOME=D:\oar-ocr-web\models
LOG_DIR=D:\oar-ocr-web\logs
LOG_RETENTION_DAYS=30Q: Browser can't open http://localhost:3000 after startup?
A: Check the console window for logs. If it says listening on port 3000 but the browser times out, Windows Firewall is blocking it — click "Allow" when prompted on first launch.
Q: Error model file pp-ocrv6_small_det.onnx not found?
A: Model download failed. Re-run .\download_models.ps1 and confirm your machine can reach modelscope.cn. You can also manually place all 9 .onnx / .txt / .json files in ./models/.
Q: OCR feels slow? A: First use loads the model (~200 MB) into RAM — expect a few seconds of delay. Subsequent recognitions are fast. Minimum recommended RAM: 4 GB.
Q: How to auto-start on boot?
A: Put a shortcut to oar-ocr-web.exe in C:\Users\<your-name>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\.
- NAS (fnOS / Synology / ZSpace, etc.)
- CPUs without AVX (e.g. Celeron N5105, J4125, N100 — common in low-power NAS)
- Background always-on service
Use the pre-built Docker Hub image directly:
docker run -d --name oar-ocr-web ^
-p 3000:3000 ^
-v ${PWD}/models:/app/models ^
-v ${PWD}/logs:/app/logs ^
-e TOKEN=your-secret-token ^
-e OAR_HOME=/app/models ^
--restart unless-stopped ^
ghcr.io/tabortao/oar-ocr-web:latestOr with docker-compose:
.\download_models.ps1
docker compose up -d# After cloning the repo, from the Dockerfile directory:
docker build -t oar-ocr-web-noavx .
docker run -d --name oar-ocr-web \
-p 3000:3000 \
-v $(pwd)/models:/app/models \
-v $(pwd)/logs:/app/logs \
-e TOKEN=your-secret-token \
-e OAR_HOME=/app/models \
--restart unless-stopped \
oar-ocr-web-noavxThe ONNX Runtime source build takes ~30–60 minutes (the ort-builder stage of the Dockerfile), but layer caching makes subsequent builds very fast. For technical details and troubleshooting notes, see docs/ChangeLog.md.
- fnOS (飞牛NAS): open the "Containers" app → New container → use image
ghcr.io/tabortao/oar-ocr-web:latest(non-AVX CPUs must build the noavx image first as shown above) → map port 3000, create persistent volumes/app/modelsand/app/logs - Synology DSM: open "Container Manager" → New container → same as above
- ZSpace / 极空间: open Docker from the app store → use the docker-compose approach above
| Method | Endpoint | Auth | Description |
|---|---|---|---|
GET |
/api/health |
No | Service health and status |
GET |
/api/auth/verify |
Yes | Verify token validity |
POST |
/api/ocr |
Yes | Text OCR (multipart upload) |
POST |
/api/ocr/json |
Yes | Text OCR (JSON: base64 or URL) |
POST |
/api/structure |
Yes | Structure analysis (multipart) |
POST |
/api/structure/json |
Yes | Structure analysis (JSON: base64 or URL) |
For detailed API documentation, see docs/api.md.
Set TOKEN in .env to enable authentication:
TOKEN=your-secret-tokenAll API endpoints (except /api/health) and the web UI require the token in the Authorization header:
Authorization: Bearer your-secret-token
| Model | Size | Purpose |
|---|---|---|
pp-ocrv6_small_det.onnx |
9.4 MB | Text detection |
pp-ocrv6_small_rec.onnx |
20.2 MB | Text recognition |
ppocrv6_dict.txt |
73 KB | Character dictionary |
pp-doclayout_plus-l.onnx |
123.7 MB | Layout detection |
pp-lcnet_x1_0_table_cls.onnx |
6.5 MB | Table classification |
slanet_plus.onnx |
7.4 MB | Table structure recognition |
table_structure_dict_ch.txt |
0.6 KB | Table structure dictionary |
pp-formulanet_plus-s.onnx |
~20 MB | Formula recognition (LaTeX) |
pp-formulanet-tokenizer.json |
~1 MB | Formula tokenizer |
MIT