{"slug": "no-internet-no-problem-how-i-built-a-crop-disease-detector-for-rural-india", "title": "No Internet? No Problem. How I Built a Crop Disease Detector for Rural India", "summary": "According to the article, KhetAI is a fully offline AI crop diagnostic tool built for Indian smallholder farmers, utilizing the Gemma 4 E4B model to analyze crop photos and answer questions without needing internet or cloud connectivity. The tool addresses the problem of farmers losing 20-30% of their harvest to unidentified diseases by providing diagnoses, treatments, and local remedies in multiple Indian languages directly on the user's device. The developer chose Gemma 4 because it handles vision, language, and multilingual responses in a single local model call, eliminating the need for separate systems or internet dependency.", "body_md": "Every year, Indian farmers lose 20–30% of their harvest to crop diseases they cannot identify in time. Agricultural experts are concentrated in cities. Internet is unreliable in villages. And most existing tools are in English - a language most farmers don't read or speak.\nI built KhetAI to change that.\nKhetAI is a fully offline AI crop diagnostic tool for Indian smallholder farmers. A farmer:\nNo internet needed. No cloud. No data ever leaves the device.\nTech Stack:\nThe result the farmer sees includes:\n▶️ Demo Video: Watch on YouTube\nReal output from KhetAI - tested with a flower photo asking \"What is it's name?\":\n{\n\"diagnosis\": \"Healthy crop - Black-eyed Susan (Rudbeckia family)\",\n\"confidence\": \"Medium\",\n\"treatment\": [\n\"Ensure soil remains consistently moist but not waterlogged\",\n\"Feed with balanced slow-release fertilizer at start of growing season\"\n],\n\"local_remedies\": [\n\"Add compost around the base to improve soil nutrients\",\n\"Light mulch layer of wood chips conserves moisture\"\n],\n\"prevention\": [\n\"Avoid overhead watering - water the base instead\",\n\"Deadhead spent flowers regularly to encourage new blooms\"\n],\n\"escalate\": false,\n\"summary\": \"Your crop is healthy - maintain consistent watering and add compost for best yields\"\n}\nGemma 4 correctly identified the plant, gave practical advice, and suggested affordable local remedies - all in one response, in the farmer's chosen language.\n🔗 GitHub Repository: https://github.com/Tech-Psycho95/KhetAI\nRun it yourself:\n# 1. Pull the model\nollama pull gemma4:e4b\n# 2. Install dependencies\npip install fastapi uvicorn python-multipart ollama\n# 3. Start the backend\nuvicorn main:app --reload --port 8000\n# 4. Open frontend\n# Just double-click index.html in your browser\nThe backend /analyze\nendpoint accepts a crop photo + question, converts the image to base64, and sends both to Gemma 4 via Ollama:\nresponse = ollama.chat(\nmodel=\"gemma4:e4b\",\nmessages=[\n{\n\"role\": \"user\",\n\"content\": f\"[Language: {language}]\\nFarmer's question: {question}\",\n\"images\": [image_b64],\n}\n],\nsystem=SYSTEM_PROMPT,\noptions={\"temperature\": 0.2},\n)\nThe system prompt instructs Gemma 4 to always return a clean structured JSON object with diagnosis, treatment, remedies, prevention, and an escalation flag. Low temperature (0.2\n) ensures consistent, reliable output every time.\nI chose Gemma 4 E4B (gemma4:e4b\n) - here's why it was the right fit:\nMultimodal out of the box\nGemma 4 processes both a crop photo and a text question together in a single API call. No separate vision pipeline, no extra model. The farmer uploads an image and asks their question — Gemma 4 analyzes both simultaneously.\nRuns fully offline via Ollama\ngemma4:e4b\nruns locally on a consumer GPU with no API key, no internet, and no subscription. This is non-negotiable for rural India deployment where connectivity is absent.\nMultilingual natively\nGemma 4 handles Hindi, Kannada, Tamil, Telugu, Marathi, Bengali, Gujarati, and Punjabi without any translation layer. I simply pass the farmer's preferred language in the system prompt — the model responds in that language automatically.\nWhy E4B over E2B or 31B Dense?\nBefore Gemma 4, this project would have required a separate vision model, a separate language model, a translation layer, and a cloud API — meaning internet dependency. Gemma 4 collapses all four into a single local model call.\nKhetAI today runs on a single device for a single farmer. The roadmap:\nThe infrastructure cost to serve 1,000 farmers? Zero. Because everything runs locally.", "url": "https://wpnews.pro/news/no-internet-no-problem-how-i-built-a-crop-disease-detector-for-rural-india", "canonical_source": "https://dev.to/shastraa_430/no-internet-no-problem-how-i-built-a-crop-disease-detector-for-rural-india-5284", "published_at": "2026-05-19 00:17:14+00:00", "updated_at": "2026-05-19 00:30:34.104843+00:00", "lang": "en", "topics": ["artificial-intelligence", "machine-learning", "large-language-models", "open-source", "startups"], "entities": ["KhetAI", "Gemma 4", "GitHub", "Tech-Psycho95"], "alternates": {"html": "https://wpnews.pro/news/no-internet-no-problem-how-i-built-a-crop-disease-detector-for-rural-india", "markdown": "https://wpnews.pro/news/no-internet-no-problem-how-i-built-a-crop-disease-detector-for-rural-india.md", "text": "https://wpnews.pro/news/no-internet-no-problem-how-i-built-a-crop-disease-detector-for-rural-india.txt", "jsonld": "https://wpnews.pro/news/no-internet-no-problem-how-i-built-a-crop-disease-detector-for-rural-india.jsonld"}}