How codebywiam/invoice-ocr works
This is an invoice/receipt OCR application with both a Streamlit interface and a headless-capable CLI. Users provide PDFs; the entry point converts pages to images, preprocesses them, runs Tesseract, extracts invoice fields, and presents or exports the structured results. The Streamlit path additionally supports field correction, bounding-box previews, and combined CSV download; the CLI saves visualizations and a summary CSV. The workflow is evidenced by README and sampled entry points; supporting module internals were not sampled, so their detailed behavior is summarized from documentation.
Main entry points: app.py Streamlit app · main.py CLI pipeline · pdf_converter.py PDF converter · ocr_engine.py OCR engine
Components 16
Entry points
- Streamlit app
app/app.py - CLI pipeline
main.py
OCR processing
- PDF converter
src/pdf_converter.py - Poppler
poppler-24.08.0 - Page images
- Image preprocessing
src/preprocess.py - Tesseract OCR
- OCR engine
src/ocr_engine.py - Field extraction
src/extractor.py
Review and export
- Box visualizer
src/visualize.py - Field review
app/app.py - Combined results
app/app.py - CSV export
app/app.py - Summary CSV
main.py
Other components
- Invoice user
- Invoice PDFs
Connections 21
- Invoice user → Streamlit app: uploads PDFs
- Invoice PDFs → Streamlit app: reads PDFs
- Streamlit app → PDF converter: converts pages
- CLI pipeline → PDF converter: converts PDFs
- PDF converter → Poppler: uses
- PDF converter → Page images: writes pages
- Streamlit app → Image preprocessing: preprocesses pages
- CLI pipeline → Image preprocessing: preprocesses pages
- Image preprocessing → OCR engine: supplies images
- OCR engine → Tesseract OCR: runs OCR
- Streamlit app → OCR engine: runs and reads OCR
- CLI pipeline → OCR engine: runs and reads OCR
- Streamlit app → Field extraction: extracts fields
- CLI pipeline → Field extraction: extracts fields
- Streamlit app → Box visualizer: draws OCR boxes
- CLI pipeline → Box visualizer: draws OCR boxes
- Field extraction → Field review: provides fields
- Invoice user → Field review: corrects fields
- Field review → Combined results: aggregates records
- Combined results → CSV export: downloads CSV
- CLI pipeline → Summary CSV: writes summary