Ghost Farmer:Gemma 驅動的離線先祖農夫聊天機械人
Ghost Farmer: An offline Ancestor Farmer powered by Gemma
Ghost Farmer 是一款由 Gemma 驅動的離線聊天機械人,模仿先祖農夫回答種植、土壤、害蟲及收成問題。它以 Ollama 在本機執行開放權重模型 gemma3:1b,並讀取 stories.txt 中的家庭故事;整個程式約 60 行 Python。程式無須連接互聯網,家庭故事留在用戶自己的電腦,但模型有時會虛構內容。
This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine
What I Built
Ghost Farmer is an offline chatbot that channels the spirit of an ancestor farmer to answer questions about planting, soil, pests, and harvest. Growing up in Kenya, as a farmer's child, my grand father often gave us advice on how to take care of plants in order to ensure great yield so I chose to work on Agriculture because I saw how helpful it is.
Demo
GitHub Link: https://github.com/Muen1/ghost-farmer.git
Screenshots:
How I Built It
-
Gemma (
gemma3:1b, an open-weight model) running locally through Ollama -
Python with the
ollamalibrary - A
stories.txtfile the ghost reads at startup, so every family gets a different ghost - A
/savecommand that builds an "ofrenda" of advice worth keeping
The whole thing is one Python file of about 60 lines. A system prompt tells the model to speak like a gentle ghost farmer, keep answers short, stay practical, and admit when it isn't sure. The family memories from stories.txt are added to that prompt, and answers stream onto the screen word by word so it feels like the ghost is speaking.
What went wrong: I got stuck before I wrote any code. I tried to install Ollama with a command meant for PowerShell while I was in Git Bash, so it failed. Then the installer hung, and my terminal said ollama wasn't recognized. I switched to the regular Windows installer, opened a fresh terminal, and it worked. That taught me that local AI is not hard to run, but the setup can fight you if you are new to it.
What surprised me: the ghost started inventing his own backstory. When I asked about aphids, he told me about a "dreadful infestation" from his own farming days and called them "little green devils." I never wrote that anywhere. A tiny 1B-parameter model, running on my laptop with no internet, gave a made-up ghost a personality. It's not always accurate, which is why I told him in the prompt never to invent exact chemical doses, but for a ghost story it's the right kind of wrong.
Why Open Source Matters Here
- It works with no internet. Many farms have poor signal, and this runs entirely on a laptop.
-
Family stories stay on your own machine. Nothing in
stories.txtis sent to a server I don't control. -
It's free to run, and I can swap the model by changing one line (
MODEL = "gemma3:1b"). - It can't disappear if a service shuts down. The model and the code are on my computer, and whoever has them can keep the ghost alive.
A closed, cloud-based chatbot would need internet and an account, and would send private family stories to someone else's servers. For a project about preserving memories, that felt wrong.
How It Fits the Theme
Día de los Muertos honors those who came before us, and marigolds, the flower of the ofrenda, are a crop. For many families, the people we remember include farmers whose knowledge was never written down. Ghost Farmer is a small way to keep that knowledge speaking. You write down what your grandparents taught you, and a ghost carries it into the next season.
來源:DEV Community · dev.to

