跳到正文
DEV Community· Yash Adake·· 3 小時前AI 評分50

Parchi 用 Gemma 4 在店舖筆電本機把 WhatsApp 訂單轉成帳單

Parchi: WhatsApp orders to bills for kirana stores, with Gemma 4 on the shop's own laptop

AI 導讀

Parchi 是一款在店舖筆電本機運行的工具,以 Gemma 4 讀取 Hinglish、馬拉地語、印地語或英語的 WhatsApp 訂單,再按店舖價目表配對商品並計算帳單。

正文

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle

What I Built

Neighbourhood kirana shops in Pune get messages like this on WhatsApp all evening:

bhaiya 2 kilo atta, 1 amul butter chhota, 6 ande, ek maggi, aur paneer bhi

The shopkeeper reads it, writes a parchi (a paper slip) by hand, looks up prices, adds them up on a calculator, types a reply, and sends his UPI ID. Then the next message arrives, this one in Marathi. It is a small job, done dozens of times a day, and every mistake is either his money or an annoyed customer.

Parchi does that job in about a second, on the shop's own laptop:

  1. Paste the WhatsApp message (or open a WhatsApp "Export chat" file and click any message).
  2. Gemma 4 reads the Hinglish, Marathi, Hindi or English and pulls out the items, quantities and size words.
  3. Plain code matches each item to the shop's own price list, converts units and builds a live bill.
  4. The shopkeeper checks a colour-coded list: green is matched, yellow needs a quick look (which size of Maggi?), red is not in the price list or out of stock. Fixing a line is a searchable picker: type "ande" and Eggs comes up.
  5. One click gives a printable packing slip, a ready-to-send WhatsApp reply (unavailable items are named in it), and a UPI QR for the exact amount.

Parchi: items checked against the price list, a saved bill, and the WhatsApp reply

Orders dashboard: today's sales, the amount still to collect, one-click New → Packed → Delivered → Paid

Who would pay: kirana stores, dairies, tiffin and mess services, and small distributors, who all take orders on WhatsApp today. A small monthly fee (say ₹199) is less than the cost of one wrong bill a week, and there is no per-order fee eating into it.

Demo

Run it locally (it is a counter-top app by design, so there is no hosted demo; a phone on the shop's Wi-Fi can open it too):

ollama pull gemma4:e4b
git clone https://github.com/YashAdake/parchi.git ; cd parchi
python -m venv .venv ; .\.venv\Scripts\Activate.ps1
pip install -e ".[dev]"
parchi        # then open http://127.0.0.1:8765 and click a sample message

Code

Parchi

WhatsApp orders → bills for neighbourhood kirana stores, on the shop's own laptop.

A customer sends "bhaiya 2 kilo atta, 1 amul butter chhota, 6 ande, ek maggi". The shopkeeper pastes it into Parchi and in about a second gets a checked order, a printable packing slip, a ready-to-send WhatsApp reply and a UPI QR for the exact amount. An open-weight model (Gemma 4, through Ollama) reads the Hinglish, Marathi, Hindi or English message. Plain code matches items to the shop's own price list and does all the money maths. Nothing leaves the computer.

New order: items checked against the price list, live bill, WhatsApp reply Orders dashboard: today's sales, still to collect, one-click status

Built for the Hacktoberfest 2026 DEV "Side Hustle" challenge.

Why it runs locally

  • The customer list stays in the shop. Orders carry names, phone numbers and what each household buys. A hosted AI API would see all of it.
  • No per-order cost. A kirana shop bills dozens of small orders a day…

How I Built It

The one rule: the model reads, code counts. Gemma 4 never sees a price and never produces a total.

  • Gemma 4 (gemma4:e4b) through Ollama reads the message. The request uses Ollama's structured output with a JSON schema, so the answer is always {raw, item, qty, unit, size} per line. The prompt carries the number words customers actually use (dedh = 1.5, aadha/अर्धा = 0.5, paav kilo = 0.25 kg, darjan = 12), size words (chhota/bada/लहान/मोठा), and three short examples, one of them a "thank you, paisa bhej diya" that must come back as not an order. Thinking is off, temperature is 0, and if the JSON is unusable it retries once and then tells the shopkeeper instead of guessing. The page warms the model up when it opens, so the first order is fast too.
  • The matcher is plain Python. Exact aliases first (ande → Eggs, kanda → Onion, दूध → Milk), then rapidfuzz with quantity words stripped from both sides. That stripping mattered: before it, "1 kg kaju katli" fuzzily matched "Fortune Sunflower Oil 1 L" because both contain "1 l"-ish text. A unit test now guards that.
  • Pack maths: "1 litre doodh" picks the 1 L pack, "2 litre" becomes two 1 L packs, "500 gm poha" becomes 0.5 kg. When the amount isn't whole packs ("paav kilo jeera" = 250 g, sold in 100 g packs) the line turns yellow with two one-tap choices, 2 × 100 g = 200 g or 3 × 100 g = 300 g, because only the shopkeeper should decide that.
  • Money is Decimal, prices come only from the price list (the API ignores any price sent in a request), and the total is rounded to the rupee with the round-off shown on the slip and in the reply. The live bill on screen is recalculated by the server on every edit, not in the browser, and once a bill is saved the items lock so the screen can never disagree with the saved order.
  • It learns without retraining, visibly: when the shopkeeper fixes "2 nimbu" once, both the customer's word and the model's reading are remembered, and they appear as customer words on that product in the price list. A wrong correction is one delete away.
  • UPI QR is a standard upi://pay?pa=…&am=… link drawn with the qrcode library. No payment API, no gateway fee.
  • FastAPI + SQLite + one HTML page with no internet fonts or CDNs, so the whole thing works offline. Dark mode and a phone layout come free with it.

Does it actually work?

scripts/eval.py runs 20 orders (34 item lines) in Hinglish, Marathi, Hindi and English through the real model and matcher on my RTX 5060 laptop:

  • 34 of 34 lines right with no help (right product and right quantity), and the "thank you" message correctly ignored.
  • Under a second per order (median 0.6–0.7 s across runs).

To be clear about what that number means: I wrote those 20 messages while building Parchi, against a 26-item sample price list, so it is not a blind test, and real customers will find phrasings it misses. That is exactly why every line is shown to the shopkeeper before a bill exists, and why the model is never trusted with money. 41 unit tests cover the matcher, the bill maths, the price-list and UPI validation, the WhatsApp export parser and the API.

Known limits: it makes an order bill, not a GST tax invoice; it bills one message at a time; it is text-only for now.

Why Does Open Innovation Matter?

For a kirana shop, a closed API would break the business three ways.

  • The customer list is the shop. Every order carries a household's name, phone number and what they buy each week. With an open-weight model on the counter laptop, none of that goes to anyone's server.
  • The margins are tiny. A kirana order is often a few hundred rupees. Paying per API call on dozens of small orders a day eats whatever the tool could charge. Locally, reading an order costs nothing after the one-time download.
  • The internet is patchy. Parchi needs no connection once the model is downloaded.

And because the model is just a setting (PARCHI_MODEL), the shop is never locked in. When a better small open model comes out, it is one ollama pull away. Gemma 4 also takes audio input, which makes the next step obvious: billing directly from customers' voice notes.

Prize Categories

  • Best Use of Gemma: Gemma 4 (gemma4:e4b) runs locally and does all the language understanding for Hinglish, Marathi and Hindi orders, constrained to a JSON schema.

來源:DEV Community · dev.to