Home / use case

Receipt Box: Gemma 3 4B in Ollama sorts a freelancer's receipts and VAT on the laptop

At a glance
Models & engines
Gemma 3 4B with vision, served by Ollama on the user's machine
Key gotcha
A 4B model misreads the odd crumpled receipt, so plan for a correction step.

What they built

Receipt Box is a receipt and invoice sorter for freelancers that runs entirely on your own laptop. It came from the end-of-quarter ritual of a folder of crumpled photos, PDF invoices in several currencies, and an accountant asking which ones have VAT.

You drop in photos or PDFs and a vision model reads each one: vendor, date, total, VAT, currency and a category such as Software, Travel or Meals. The app then shows a dashboard of total spend, VAT to reclaim and spend by category and month, plus a VAT-by-quarter table, which is the number a freelancer actually hands to the accountant.

The author treats receipts as some of the most sensitive boring data you have (who you work for, where you travel, what you pay for), so the only network call the app makes goes to localhost.

Setup

  • Gemma 3 4B with vision, served by Ollama on the user's machine
  • A Dash app with Plotly charts, pandas for the numbers and openpyxl for the Excel export
  • PyMuPDF to render scanned PDFs to images
  • pytest tests for duplicates, quarters, rules and exports; code on GitHub (banana0000/receipt-box)

How it works

  1. Each image goes to Gemma with a JSON schema (vendor, date, total, vat, currency, category) and the category is constrained to a fixed list, so the reply always parses with no regex and no retry loop.
  2. PDFs with a text layer send the text straight to the model, which is faster; scanned PDFs are rendered to an image and go through the vision path.
  3. Files are processed in a queue and the page shows progress such as "Reading 2 of 5" instead of freezing.
  4. The prompt tells the model to use only what is printed and never guess. Changing a vendor's category once in the editable table teaches the app to sort that vendor the same way from then on.

Results & numbers

  • On a CPU a receipt takes roughly 15 to 20 seconds.
  • The app also handles duplicate detection, multi-currency totals and CSV or Excel export.
  • The author's main lesson: a small model is allowed to be wrong as long as fixing it is cheap, so the correction table and learned vendor rules matter more than the model itself.

Gotchas

  • A 4B model misreads the odd crumpled receipt, so plan for a correction step.
  • Gemma 3 4B needs about 4 to 5 GB of RAM; for the hosted demo the Ollama service needed a large instance.
  • Switching to a bigger Gemma or a GPU is a one-line change through the RECEIPT_MODEL setting.
“A small model is allowed to be wrong, as long as fixing it is cheap.”— E. Smith

Do it yourself

  1. Install Ollama and pull a Gemma 3 4B vision model.
  2. Clone banana0000/receipt-box from GitHub.
  3. Run the app and drop in the sample documents from the samples folder to see the dashboard fill in.
  4. Add your own receipt photos and PDFs and fix any misread vendor or category in the table.
  5. Export the quarterly VAT table to CSV or Excel for your accountant.
Source: E. Smith (DEV Community) · Published 2026-10-26 · Added 2026-10-28. This write-up summarizes the original source; see it for full details.

Similar setups

Paper to Portfolio: local Gemma 4 reads an old share certificate, Python does the maths

Rahul Kumar built Paper to Portfolio, which uses gemma4:e4b in Ollama on a CPU-only laptop to read an old Indian share certificate and pick out bonuses, splits and mergers from pasted filings, while plain Python checks every quote and does all the arithmetic.

Rahul Kumar (DEV Community) · 2026-10-27

A local contract and invoice agent whose citations are checked by code

Gonzalo Blasco built a laptop-only agent that answers questions about contracts and invoices and only accepts a citation if its quote literally appears in the retrieved chunk; Gemma 4 12B got 18 of 18 of his test questions right.

DEV Community (Gonzalo Blasco) · 2026-11-21

Availazy: Gemma 4 E2B turns a week of volunteer chat messages into an availability sheet

Bipul Chamoli built Availazy, a local review tool where Gemma 4 E2B in Ollama copies the availability words from volunteer chat messages, plain Python works out the dates, and the coordinator accepts or rejects each suggestion.

Bipul Chamoli (DEV Community) · 2026-10-26

FollowUp Local: Gemma 3 on a laptop explains why a sales chat went quiet

FollowUp Local is a one-file Python tool for people who sell through chat: paste a customer conversation and Gemma 3 via Ollama names the stage it stalled at, the real concern, a quoted line of evidence and a draft follow-up.

dongwei-polyred (DEV Community) · 2026-10-25