{"slug": "i-built-an-offline-sales-analyst-for-small-shops-with-ollama-and-duckdb", "title": "I Built an Offline “Sales Analyst” for Small Shops with Ollama and DuckDB", "summary": "A developer built AskMyShop, an offline natural-language sales analyst for small shops that runs Qwen2.5 7B locally through Ollama and queries uploaded CSV or Excel files directly with DuckDB. The Streamlit and Plotly app returns a chart, a one-line plain-language insight, and the generated SQL, with a read-only SELECT safety layer and a single retry that feeds SQL errors back to the model. The developer says keeping data on the owner's laptop avoids per-question API fees and works without reliable internet.", "body_md": "This is a submission for the Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle\n\nWhat I Built\n\nAskMyShop 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.\n\nMany 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.\n\nWith AskMyShop, the owner uploads their sheet, types a question (e.g. “Which items sold least last month?”), and gets:\n\na chart\n\na one-line insight in simple words\n\nthe SQL used, so they can see how the answer was found\n\nWho would pay: small restaurants, tiffin shops and grocery stores. Pricing idea: [₹499 one-time setup, or ₹199/month for monthly report templates].\n\nDemo\n\nTip: Show the Wi-Fi turned off in the video. It proves the “private and offline” claim in two seconds.\n\nCode\n\n**An asynchronous, GPU-accelerated Telegram Bot engineered using Pyrogram and faster-whisper (`distil-large-v3`). Automatically extracts English audio streams, transcribes multi-channel media, and generates mobile-optimized, styled Advanced SubStation Alpha (`.ass`) English subtitles.**\n\n`distil-large-v3` running on CUDA `float16` hardware acceleration, achieving `round()`‑based) to eliminate IEEE 754 drift on long files.`.mkv`, `.mp4`, `.avi`), prefers explicit English streams, and converts raw Audio to 16kHz mono PCM WAV with a `.ass`) files with a How I Built It\n\nModel: [Qwen2.5 7B / Qwen2.5-Coder] running locally through Ollama\n\nQuery engine: DuckDB, which queries the uploaded CSV/Excel directly with no database setup\n\nStructured output: Instructor with a schema, so the model returns the SQL and the chart type in a predictable format\n\nUI and charts: Streamlit with Plotly\n\nSafety layer: only read-only SELECT queries are allowed, and if the SQL fails, the error is sent back to the model for one retry\n\nPrompt 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\n\n(Optional) faster-whisper for asking questions by voice\n\nWhat 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.]\n\nWhy Does Open Innovation Matter?\n\nPrivacy: sales and customer data never leave the owner’s laptop. For a small shop, that data is the business.\n\nCost: 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.\n\nWorks offline: many small shops have unreliable internet, and this works without it.\n\nCustomization: I could tune the prompt with the shop’s own column names and item names (including Tamil names), which a generic tool handles poorly.\n\nNo 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.\n\n[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.”]\n\nMy First User\n\n[Who they are: a shop owner, a relative who runs a business, a tea stall, a hotel.]\n\nWhat they asked first:\n\nWhat worked / what confused them:\n\nWould they pay, and how much:\n\nWhat they asked for next:\n\nIf you haven’t shown it to anyone by the deadline, delete this section.", "url": "https://wpnews.pro/news/i-built-an-offline-sales-analyst-for-small-shops-with-ollama-and-duckdb", "canonical_source": "https://dev.to/sriram03/i-built-an-offline-sales-analyst-for-small-shops-with-ollama-and-duckdb-1e56", "published_at": "2026-10-17 12:28:06+00:00", "updated_at": "2026-10-17 12:34:27.412821+00:00", "lang": "en", "topics": ["ai-tools", "large-language-models", "ai-agents", "developer-tools"], "entities": ["Ollama", "DuckDB", "Qwen2.5", "Streamlit", "Plotly", "Instructor", "faster-whisper", "AskMyShop"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/i-built-an-offline-sales-analyst-for-small-shops-with-ollama-and-duckdb", "markdown": "https://wpnews.pro/news/i-built-an-offline-sales-analyst-for-small-shops-with-ollama-and-duckdb.md", "text": "https://wpnews.pro/news/i-built-an-offline-sales-analyst-for-small-shops-with-ollama-and-duckdb.txt", "jsonld": "https://wpnews.pro/news/i-built-an-offline-sales-analyst-for-small-shops-with-ollama-and-duckdb.jsonld"}}