KrishiBot — AI Agriculture Assistant
An offline-first AI agricultural assistant for smallholder farmers in South Asia — powered by a local LLM, bilingual (English & বাংলা), no cloud, no API keys.
Overview
What it does
Detects crop diseases from photos, answers farming questions in natural language, plans treatments on a 14-day calendar, checks weather-driven disease risk, and lets farmers share disease sightings with the community.
Problem it addresses
Smallholder farmers often can't rely on cloud services. The LLM runs locally through Ollama — no subscriptions, no internet required after setup, and no data leaves the device.
Built as
A Final Year Project demonstrating how open-source LLMs can address real agricultural problems for users who can't rely on cloud services.
The backend is FastAPI with SQLAlchemy, talking to Ollama's qwen2.5:3b model for chat, analysis, advisory and treatment plans. Image analysis feeds filename-based crop hints to the text model, which keeps RAM requirements low; the qwen2.5vl:3b vision model is optional. The Next.js 14 frontend streams chat responses token by token over Server-Sent Events.
Key Features
Bilingual streaming chat
English and Bangla with an instant toggle, token-by-token SSE streaming, multi-session history and voice input via the Web Speech API.
Crop disease detection
Upload a leaf or crop photo for a structured diagnosis with severity staging (Early / Moderate / Severe), a confidence rating, and a PDF report export.
Market context
Estimates crop value, projected loss, treatment cost and net saving to give an ROI verdict on treating a disease.
14-day treatment calendar
Auto-generated day-by-day schedule per detected disease, with a robust JSON fallback if the LLM output is malformed.
Weather & risk alerts
Open-Meteo forecasts (no API key) drive heuristic fungal and bacterial disease-risk scoring over the next 48 hours.
Community disease board
Anonymous crowd-sourced disease reports aggregated across all 8 Bangladesh divisions, with a stats dashboard.
Tech Stack
| Frontend | Next.js 14 (App Router), React 18, TypeScript, Tailwind CSS, Lucide icons |
|---|---|
| Backend | FastAPI, SQLAlchemy 2, Pydantic v2, httpx (async) |
| LLM | Ollama — qwen2.5:3b (text), qwen2.5vl:3b (vision, optional) |
| Database | SQLite by default; PostgreSQL supported via environment variable |
| Services | ReportLab (PDF reports), Open-Meteo (weather), Server-Sent Events (streaming) |
| Deployment | Docker image for the backend; frontend on Vercel |