Mindee DocTR OCR Capabilities through REST api
408
(https://github.com/spikeyz/mindee-doctr-api)
A Docker image that wraps Mindee's docTR library and exposes all its features through an HTTP REST API built with FastAPI.
| Method | Path | Description |
|---|---|---|
| GET | /health | Health check |
| GET | /models | List available model architectures |
| POST | /ocr | End-to-end OCR — image or PDF |
| POST | /detect | Text detection only |
| POST | /recognize | Text recognition only (cropped word image) |
| POST | /kie | Key Information Extraction |
| POST | /export/text | OCR → plain text |
| POST | /export/hocr | OCR → hOCR XML |
| POST | /export/searchable-pdf | OCR → searchable PDF |
| POST | /visualize | OCR → annotated PNG |
Interactive documentation is available at http://localhost:8000/docs once the container is running.
docker compose build
docker compose up -d
Requires nvidia-container-toolkit.
Uncomment the args block in docker-compose.yml, then:
docker compose build --build-arg PIP_EXTRA_INDEX_URL=https://download.pytorch.org/whl/cu121
docker compose up -d
# Health check
curl http://localhost:8000/health
# List available models
curl http://localhost:8000/models
# End-to-end OCR on an image
curl -X POST http://localhost:8000/ocr \
-F "[email protected]"
# End-to-end OCR on a PDF with a different model pair
curl -X POST "http://localhost:8000/ocr?det_arch=fast_base&reco_arch=parseq" \
-F "[email protected]"
# Detection only
curl -X POST http://localhost:8000/detect \
-F "[email protected]"
# Recognition only (cropped word image)
curl -X POST http://localhost:8000/recognize \
-F "file=@word_crop.png"
# Key Information Extraction
curl -X POST http://localhost:8000/kie \
-F "[email protected]"
# Export as plain text
curl -X POST http://localhost:8000/export/text \
-F "[email protected]"
# Export as hOCR XML
curl -X POST http://localhost:8000/export/hocr \
-F "[email protected]" -o output.xml
# Export as searchable PDF
curl -X POST http://localhost:8000/export/searchable-pdf \
-F "[email protected]" -o searchable.pdf
# Visualise with bounding boxes (returns PNG)
curl -X POST http://localhost:8000/visualize \
-F "[email protected]" -o annotated.png
| Architecture | Notes |
|---|---|
db_resnet34 | Lightweight DBNet |
db_resnet50 | Default – best accuracy/speed trade-off |
db_mobilenet_v3_large | Mobile-friendly |
linknet_resnet18 | Fast |
linknet_resnet34 | |
linknet_resnet50 | |
fast_tiny | Fastest |
fast_small | |
fast_base |
| Architecture | Notes |
|---|---|
crnn_vgg16_bn | Default |
crnn_mobilenet_v3_small | Lightweight |
crnn_mobilenet_v3_large | |
sar_resnet31 | |
master | |
vitstr_small | Vision Transformer |
vitstr_base | |
parseq | State-of-the-art accuracy |
| Environment variable | Default | Description |
|---|---|---|
WORKERS | 1 | Number of uvicorn workers |
DOCTR_CACHE_DIR | /app/.cache/doctr | Model weight cache directory |
Content type
Image
Digest
sha256:b31c0e53e…
Size
3.1 GB
Last updated
4 months ago
docker pull spikeyz/mindee-doctr-api