This is a submission for the Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle
What I Built
ReceiptSorter turns a pile of receipts and invoices into a clean expense CSV. You drop in text files, PDFs or phone photos of receipts, and open-weight models running on your own computer read each one and pull out the vendor, date, total, currency and an expense category. You fix anything that looks off in an editable table, then download a CSV or a ZIP with the receipts renamed and sorted into category folders. A receipt-style tape on the side adds up the totals by category.
Who would pay for it: freelancers and one-person businesses who dread month-end bookkeeping, and the small accountants and bookkeepers who receive a messy bundle of receipt photos from clients every month. The invoices they handle name their clients and show what they charge, which is exactly the data many of them do not want to upload to a random cloud service. That makes "nothing leaves your laptop" a real selling point rather than a footnote.
The problem it solves: every month-end they lose hours renaming files, retyping totals into a spreadsheet and guessing categories. ReceiptSorter turns that into drag, check, download.
Demo
Run it yourself in under a minute (the sample receipts need no model at all):
git clone https://github.com/Hasalawa/receiptsorter
cd receiptsorter
python3 webapp.py # opens http://127.0.0.1:8765, then click "Try sample receipts"
For the AI part, install Ollama and pull the models once:
ollama pull qwen2.5:7b-instruct # text and PDF receipts
ollama pull qwen2.5vl:7b # photos of receipts
There is also a CLI for folders of receipts:
$ python3 receiptsorter.py samples --out sorted --move-files
- cafe.txt: Cafe Ceylon | 2026-10-08 | 4100.0 LKR | Meals
- hosting.txt: Lanka Cloud Hosting (Pvt) Ltd | 2026-09-03 | 8500.0 LKR | Software
- keyboard.txt: Tech Mart Electronics | 2026-10-01 | 24990.0 LKR | Hardware
- taxi.txt: PickMe Rides | 2026-09-12 | 3250.0 LKR | Travel
Wrote sorted/receipts.csv (4 receipts)
Code
Hasalawa
/
receiptsorter
Local-first receipt & invoice sorter for freelancers. Drop in text, PDF or phone photos; open-weight models (via Ollama) extract vendor, date, total and category into a CSV, so client data never leaves your laptop.
ReceiptSorter
Sort freelancer receipts and invoices into a clean CSV and category folders, entirely on your own machine A local open-weight model (via Ollama) reads each receipt and extracts vendor, date, total, currency and expense category. No cloud API, no client data leaving your laptop.
Web app (easiest)
python3 webapp.py
Opens http://127.0.0.1:8765 in your browser. Drag receipts in (or click Try sample receipts), fix anything the model got wrong, then download the CSV or a ZIP sorted into category folders. The server only listens on your own computer and works offline.
Photos of receipts
Phone photos are read by a local vision model, so you don't need OCR software. Install one once:
ollama pull qwen2.5vl:7b
Photos can take up to a minute each on a laptop without a GPU. If no vision model is installed, the app falls back to Tesseract OCR when it is available…
How I Built It
The open pieces are what make it work:
-
Ollama +
qwen2.5:7b-instructreads text and PDF receipts. I pass a JSON schema through Ollama's structured output (format), so the model has to return exactly the fields I need and a category from a fixed list. That removes the fragile "parse whatever the model said" step. Temperature is 0 so the same receipt gives the same answer. -
Ollama +
qwen2.5vl:7b, an open vision model, reads photos directly. Most real receipts are phone photos, and a vision model avoids the OCR step entirely. Big photos are rotated correctly and shrunk first (Pillow) so a laptop without a GPU stays usable. - Prompting that matters for receipts: the total is the final amount payable (the "TOTAL BILL" line), never the cash handed over or the change.
-
Three fallbacks so the tool never dead-ends: vision model, then Tesseract OCR if it is installed, then plain regex rules if Ollama is not running. When something is missing, the error says exactly what to install (for example
ollama pull qwen2.5vl:7b), not just "failed". -
A small local web UI: a standard-library Python server and one HTML file, with no frameworks and no CDN, so it works offline. It listens on
127.0.0.1only and rejects requests with a foreignHostorOrigin, so a random website cannot talk to it. Every cell in the results table is editable, and the totals and downloads update as you fix things. - Quality checks: 17 unit tests using a fake Ollama server (including the vision path and the "model not installed" message), a UI test in a real browser, and a GitHub Actions workflow that runs them on Python 3.10 and 3.12.
Why Does Open Innovation Matter?
- The data stays on the machine. Receipts reveal clients, prices and spending habits. With a closed API I would have to send every image to someone else's server. With local open-weight models I can honestly say nothing leaves the laptop, and it keeps working with no internet.
- The economics work for a side hustle. A hosted vision API charges per image, which punishes exactly the customer with a big monthly pile of receipts. Local inference costs nothing per receipt, so a flat price or a one-off setup service can have real margin.
-
I can swap and tune. The model is one flag (
--model,--vision-model). If a bigger model, a smaller one or a model fine-tuned on local receipts (Sri Lankan vendors and LKR amounts, for example) works better, I change a string. I am not tied to someone else's pricing, rate limits or deprecation schedule. - Open pieces made the product, not just the backend. Ollama's structured output, an open vision model and plain Python were enough to build the whole thing, with nothing to sign up for.
What I have not verified yet
I tested the code paths thoroughly with sample receipts and a fake Ollama server, and ran a real receipt photo through the UI using the OCR fallback. I have not yet checked the vision model's accuracy on real receipts, and photos can take up to a minute each on a CPU-only laptop. Next steps are an accuracy check on real receipts, a per-vendor "learn my categories" setting, and batch speed-ups.



Top comments (0)