Experience · MajestEYE internship
Invoice extraction at MajestEYE
During my internship at MajestEYE I built a service that reads invoice images and PDFs and returns the invoice number, date and amount as JSON, with two engines to choose from.
The problem
Invoices arrive as photos, scans and multi-page PDFs. The systems that use them need three fields, the invoice number, the date and the amount, as clean JSON. During my internship at MajestEYE I built the service that does that.
Two engines
Tesseract. The image is converted to grayscale, thresholded to black and white, rotated upright, resized and denoised. Tesseract reads the cleaned image, then regular expressions and spaCy pick out the three fields. It is the fast option.
Vision LLM. Llama 3.2 Vision runs locally through Ollama. The prompt asks it to act as a data-extraction expert and return only the three fields as raw JSON, which the service parses and returns. It is more accurate, and slower.
pick the engine per invoice.The service
A FastAPI backend exposes one upload endpoint per engine (POST /tesseract/extract and POST /llm/extract), converts PDFs page by page with pdf2image, and stores extracted results in SQLite through SQLAlchemy (/invoices/). A small React front end uploads a file, shows the JSON, and lets you download it or save it.
Result
The OCR and LLM pipeline reached 92% accuracy during the internship.