7e706793fa
- Add AGENTS.md and project-specific Zed skills (odoo-ocr-pipeline, odoo-xml-import, local-vlm-client). - Implement Pydantic schemas for documents, invoices, review results, and VLM responses. - Add unified BaseVLMClient with Ollama implementation and llama.cpp stub. - Build pipeline stages: loader, classifier, digital_pdf/scanned_print/handwritten/mixed_unknown branches, extractor, reviewer, xml_builder. - Add CLI entry point with sidecar JSON and confidence-gated XML output. - Include prompts for classifier, OCR, extraction, and review models. - Add tests with FakeVLMClient; pytest, ruff, and mypy all pass.
47 lines
1.2 KiB
Markdown
47 lines
1.2 KiB
Markdown
# odoo_ocr
|
|
|
|
Local-first invoice OCR pipeline that reads scanned, printed, handwritten, and native-PDF invoices and produces Odoo Enterprise-ready XML.
|
|
|
|
## Quick start
|
|
|
|
1. Install dependencies:
|
|
```bash
|
|
uv sync --all-extras
|
|
# or
|
|
pip install -e ".[dev]"
|
|
```
|
|
|
|
2. Configure `config.yaml` or set environment variables:
|
|
```bash
|
|
export OLLAMA_BASE_URL="http://100.103.83.12:11435"
|
|
```
|
|
|
|
3. Run the pipeline:
|
|
```bash
|
|
odoo-ocr process /path/to/invoices --output ./out/
|
|
```
|
|
|
|
## Architecture
|
|
|
|
```
|
|
Input File
|
|
→ Classifier (heuristic + small VLM)
|
|
→ Branch: digital_pdf → text/layout extraction
|
|
→ Branch: scanned_print → preprocess → VLM OCR
|
|
→ Branch: handwritten → preprocess → GLM-OCR
|
|
→ Branch: mixed_unknown → preprocess → ensemble OCR
|
|
→ Structured Extraction VLM
|
|
→ Review VLM (image vs extracted JSON)
|
|
→ Confidence check
|
|
→ XML Builder
|
|
→ Odoo XML + sidecar JSON
|
|
```
|
|
|
|
## Project-specific agent skills
|
|
|
|
Agent skills are in `.agents/skills/`:
|
|
|
|
- `odoo-ocr-pipeline` — classifier, branches, extraction, review.
|
|
- `odoo-xml-import` — generating and validating Odoo XML.
|
|
- `local-vlm-client` — Ollama/llama.cpp VLM clients and prompts.
|