AskMyShop:我用 Ollama 和 DuckDB 為小店打造離線「銷售分析師」
I Built an Offline “Sales Analyst” for Small Shops with Ollama and DuckDB
AskMyShop 是一款離線應用,以 Ollama 本機運行 Qwen2.5 7B / Qwen2.5-Coder,配合 DuckDB 讓小店用自然語言查詢銷售資料。店主上載 CSV/Excel 後可取得圖表、一句簡明分析及所用 SQL,系統只允許唯讀 SELECT 查詢。銷售及客戶資料不會離開店主的手提電腦,亦毋須按問題支付 API 費用。
This is a submission for the Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle
What I Built
AskMyShop is a local app that lets a small shop or restaurant owner ask questions about their sales in plain language and get a chart plus a one-line answer.
Many small businesses keep sales in Excel or CSV exports from a billing app, but can’t afford an analyst. They’re left asking questions like “which dish is not selling?” or “which day is my busiest?” and guessing the answers.
With AskMyShop, the owner uploads their sheet, types a question (e.g. “Which items sold least last month?”), and gets:
a chart
a one-line insight in simple words
the SQL used, so they can see how the answer was found
Who would pay: small restaurants, tiffin shops and grocery stores. Pricing idea: [₹499 one-time setup, or ₹199/month for monthly report templates].
Demo
Tip: Show the Wi-Fi turned off in the video. It proves the “private and offline” claim in two seconds.
Code
How I Built It
Model: [Qwen2.5 7B / Qwen2.5-Coder] running locally through Ollama
Query engine: DuckDB, which queries the uploaded CSV/Excel directly with no database setup
Structured output: Instructor with a schema, so the model returns the SQL and the chart type in a predictable format
UI and charts: Streamlit with Plotly
Safety layer: only read-only SELECT queries are allowed, and if the SQL fails, the error is sent back to the model for one retry
Prompt design: the prompt includes the table schema, sample rows, and a few example questions with correct SQL, tuned to the shop’s own column names
(Optional) faster-whisper for asking questions by voice
What I learned: [e.g. small models sometimes write wrong SQL, so showing the query under every answer built trust, and schema plus examples in the prompt improved accuracy.]
Why Does Open Innovation Matter?
Privacy: sales and customer data never leave the owner’s laptop. For a small shop, that data is the business.
Cost: there’s no per-question API fee, so a low flat price still leaves a margin. With a paid API, every question the owner asks would eat into a ₹199/month plan.
Works offline: many small shops have unreliable internet, and this works without it.
Customization: I could tune the prompt with the shop’s own column names and item names (including Tamil names), which a generic tool handles poorly.
No lock-in: if a better open model comes out, or the shop has an older laptop, I can swap the model without rewriting the app.
[Add one honest comparison here, e.g. “I tried the same questions on a hosted model: accuracy was [X], but it required uploading the data and costs [Y] per query.”]
My First User
[Who they are: a shop owner, a relative who runs a business, a tea stall, a hotel.]
What they asked first:
What worked / what confused them:
Would they pay, and how much:
What they asked for next:
If you haven’t shown it to anyone by the deadline, delete this section.
來源:DEV Community · dev.to