Invoice NER extracts invoice numbers from invoice images with heuristics and a local LayoutLMv3 ONNX model, with OpenRouter as an optional fallback. Set OPENROUTER_API_KEY to enable the fallback. It includes a FastAPI API, a Gradio upload demo, and a Next.js invoice review frontend.
Requires Python 3.10+ and uv. The large ONNX model is managed outside Git; make it available at the configured model path before starting.
uv sync --extra dev
cp .env.example .env
uv run python -m src.demo --host 127.0.0.1
Open http://127.0.0.1:7860/ for the upload UI or http://127.0.0.1:7860/docs for the API.
To upload a sample invoice and OCR JSON file:
curl -F 'image=@invoice.jpg' -F 'ocr_file=@ocr.json' http://127.0.0.1:7860/predict
uv run pytest
See Testing for contract and container checks.
- API usage
- Developer setup and data labeling
- Dataset and labeling notes (Notion)
- Runpod deployment
- Monitoring
- Benchmarks
- Model card
- Next.js frontend setup and deployment
Upload a receipt, review the invoice number, then confirm or copy it.
src/ API, upload UI, and inference
scripts/ Training, preprocessing, and model export
deploy/ Dockerfiles and Runpod worker setup
frontend/ Next.js invoice review app
tests/ Pytest, end-to-end, and load tests
data/ models/ Datasets and model files
docs/ monitoring/ Guides and production monitoring
benchmarks/ Model evaluation
notebooks/ Exploration and analysis
triton_model_repo/ Triton model configuration


