跳到正文
DEV Community· Abhinav Singh·· 2 小時前AI 評分48

Local Listing Writer:為小商戶打造離線商品刊登工具,並發現小型 AI 模型需要防護機制

I built an offline listing writer for small sellers, and learned that small AI models need guardrails

AI 導讀

作者打造 Local Listing Writer,讓小商戶離線生成商品刊登文案,並發現 Gemma 小型模型會捏造產品資料。測試中的 gemma3:1b 編造尺寸和產品特點;只用英文詞表的 claim checker 亦漏掉印地語中的虛構描述。工具在英文表現良好,但印地語和 Hinglish 仍不可靠,產品資料不會離開用戶電腦。

正文

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

What I Built

I built Local Listing Writer, a small web app that writes product listings for online sellers. It runs entirely on your own laptop, so there's no API key, no cost per listing, and your product details never leave your machine.

You type a product name and a few facts like material, size, colour and price. Then you pick a platform (Etsy, eBay, Amazon, Instagram shop or a WhatsApp catalogue), a tone, and a language: English, Hindi or Hinglish. It gives you back a title, a short description, bullet points and hashtags.

I wanted to see if a small open model on an ordinary laptop could actually be useful for people who sell things online. Writing listings is repetitive, and a lot of small sellers won't pay a monthly subscription for it. The model turned out to be the easy part. Getting it to stop making things up was the hard part, and it gets harder outside English.

So who would pay for this? Small sellers, like home-based resellers and shop owners, who write lots of similar listings and want something free, private and offline.

Demo

The app runs locally, so there's no live link, just my test runs. One thing to flag up front: I tested the 4B and 1B models on different inputs, so I can't say how much of the difference comes from model size and how much from the 1B input being shorter.

First, gemma3:4b, with this input: "Jute tote bag, 14x16 inch, natural colour, Rs 200, for shopping and college"

  • English came out clean. Everything in it traces back to what I typed.
  • Hinglish was readable, but it added an #ecofriendly hashtag I never wrote, and the bullet points came out in plain English.
  • Hindi called the bag "टिकाऊ" (durable) and "स्टाइलिश" (stylish). I never wrote either word. It also wrote the hashtags in Hindi, even though I told it to use English.

gemma3:4b English output: clean listing using only the facts I typed

gemma3:4b Hinglish output with an extra #ecofriendly hashtag I never wrote

gemma3:4b Hindi output calling the bag durable and stylish

Then gemma3:1b, with a much thinner input: "Handmade jute tote bag" and "Ecofriendly price-200, color red"

  • English invented a size ("14 inches by 8 inches"), a "sturdy, reinforced handle", and words like durable and sustainable. None of that was in my input.
  • Hinglish ignored the language setting and answered in plain English. It made up "perfect size for books, groceries" and "each one is unique". My claim checker did catch handcrafted, durable and 100%.

gemma3:1b English output with an invented size, reinforced handle and durable claims

gemma3:1b Hinglish output in English with the claim checker warning about handcrafted, durable and 100%

Three things stood out from these tests.

Small models fill gaps with confident-sounding claims. The 1B model invented a measurement and a product feature that nobody gave it.

A guardrail can quietly fail in another language. My claim checker caught "durable" in English but missed "टिकाऊ" in Hindi, because my word list was English-only. Even the 4B model slipped.

And a word list can only catch so much. It can't spot an invented measurement or a made-up handle, which is why the app still tells people to read the text before publishing.

Code

https://github.com/Abhinav55849/Local-listing-writer

GitHub logo Abhinav55849 / Local-listing-writer

Local Product Listing Writer: a private, offline Streamlit app that writes e-commerce listings in English, Hindi and Hinglish using Gemma (open-weight) via Ollama, with a claim checker that flags invented claims.

Local Product Listing Writer

A small Streamlit app that writes product listings (title, description, bullet points, hashtags) for sellers on Etsy, eBay, Amazon, Instagram and WhatsApp. It supports English, Hindi and Hinglish.

It runs fully on your own laptop with Gemma, an open-weight model, through Ollama. Product details never leave your computer, it costs nothing to run, and it works offline.

Example output from gemma3:4b in English

Features

  • Platform, tone and language options
  • Strict prompt that tells the model to use only the seller's facts
  • Guard that asks for more details instead of letting the model guess
  • Claim checker that warns about risky words the seller never typed
  • Model switch between gemma3:1b (fast) and gemma3:4b (more accurate)

Setup

  1. Install Ollama and pull a model:
   ollama pull gemma3:1b
   ollama pull gemma3:4b
  1. Install the Python packages:
   pip install -r requirements.txt
  1. Run the app:
   streamlit run listing_writer.py

Known limits

Small models can still invent claims such as "durable" or…

How I Built It

It's Python with Streamlit for the interface, and the Ollama Python client to run Gemma 3 (1B and 4B) locally. In my runs the 1B model was faster and the 4B model was a bit slower.

A small model left alone writes confident, flowery copy. In a product listing that's a real problem, because a made-up feature is a false claim to a buyer. So I wrapped the model in rules:

  • A strict system prompt: use only the seller's facts, and never invent materials, sizes, prices, certifications or words like "premium" and "organic".
  • A fixed output format (Title, Description, Bullet points, Hashtags) and a low temperature of 0.3 to keep results steady.
  • An input check: if the seller gives too little detail, the app asks for more instead of letting the model guess.
  • A claim checker: after generation, it scans the output for risky words (handmade, durable, organic, waterproof and so on) that the seller never typed, and shows a warning.
  • A cleanup step: if the model adds a chatty intro, the app cuts everything before "Title:".
  • A language hint for each language, including an example sentence for Hinglish.

Hindi and Hinglish were the hardest part, and I haven't solved them. For Hinglish I wrote a specific hint, telling the model to mix Hindi words in English letters, the way people chat on WhatsApp. The 1B model ignored it and answered in plain English. The 4B model mixed languages inconsistently, with a Hinglish description but English bullet points. In Hindi mode it ignored my rule about English hashtags and slipped in "durable" and "stylish", which my English-only checker never noticed.

I could keep tightening the prompts, but the bigger lesson is that instructions and guardrails both have to be tested in every language you support, not just the one you wrote them in. Right now the app works well in English and is usable but unreliable in Hindi and Hinglish.

Next, I want to run both models on identical inputs to measure the difference properly, and add Hindi and Hinglish words to the claim checker.

Why Does Open Innovation Matter?

Open-weight models are what make this project possible. Because Gemma runs locally, the app works offline, costs nothing per listing, and keeps seller data on the seller's own machine. A closed API would add a per-use cost, need an internet connection, and send product details to someone else's server, which is a bad fit for small sellers on tight budgets and patchy connections.

Open models also let me switch between a faster 1B and a more accurate 4B with one dropdown, and see exactly how model size changes the output.

Prize Categories

Best Use of Gemma: the whole app runs on Gemma (gemma3:1b and gemma3:4b) locally through Ollama, and I compared how the two sizes behave across English, Hindi and Hinglish.

來源:DEV Community · dev.to