devto 2026-10-11 원문 보기 ↗
This is a submission for the MLH x DEV Writing Challenge
India has over 100 million farming households, and most of them make their biggest decisions on guesswork: what to plant this season, how much fertilizer to buy, whether those brown spots on a leaf are an emergency. The advice that exists is generic. It ignores the farmer's soil, climate and nutrient levels, and it rarely speaks the farmer's language.
KisanConnect is our attempt at fixing that. Built by Team Code Hunters at Innohacks 4.0 (KIET, Ghaziabad), it is one Flask app where a farmer enters soil numbers or uploads a leaf photo and gets a clear decision back:
KisanConnect is built on the open-source KrishiDisha project by Shivpratap Singh Panwar, Abhishek Chourasia and Goutam Mandloi (IEEE ICoEIT 2025), and it carries the same PolyForm Noncommercial licence. Our work was the rebrand, environment setup and fixes (for example, the yield trainer now uses a dense one-hot encoder so it trains on current scikit-learn), integration, the Gemini-powered assistant setup, deployment on Render and the demo. The upstream authors' reported results are theirs, and our README says so.
The app runs on Render's free tier, so if it has been idle, the first load can take up to a minute while the service wakes up.
Farmer / Admin
│
Flask app (blueprints: main · auth · farmer · marketplace · admin · chat · api)
│
Services: ml · disease · knowledge · tools · llm · fallback_bot · weather · market · reports
│
├── models/ crop · fertilizer · yield · disease
├── data/ CSV datasets + knowledge JSON (schemes, products, guides, calendar, pests, MSP)
├── APIs Open-Meteo · data.gov.in Agmarknet · Gemini API
└── DB SQLite (default) or MySQL
A Random Forest takes N, P, K, temperature, humidity, pH and rainfall and returns the top-3 crops with predict_proba. Before predicting, we check whether the inputs fall inside the training range (1st to 99th percentile). If they don't, the farmer gets a caution warning instead of a confident answer about conditions the model has never seen.
This is the design decision I like most. The dataset has only 99 rows, so a high Random Forest score there is memorisation, not skill. So the recommendation comes from agronomy rules:
The classifier still runs, but only as a labelled model_hint. It is shown, never obeyed.
Our trainer never receives Production as an input, because production divided by area is the target, and including it would leak the answer. Missing fertilizer and pesticide values are filled from the State × Crop median, falling back to crop, then global. On a time split (train up to 2016, test 2017-2020), no model we tried beat the 5-year Crop × State median (MAE 1.10 t/ha, R² 0.66). So the baseline ships, together with a 10th-90th percentile interval so farmers see a range, not false precision.
leaf photo → preprocess → is it a leaf? → classifier → confident enough? → result
│ no │ no
▼ ▼
reject, clear message show as uncertain,
ask for a clearer photo
A plant check rejects non-leaf images. A confidence threshold turns shaky predictions into "uncertain" instead of a wrong diagnosis. A confident result returns the condition, prevention steps, matching marketplace products and a downloadable PDF report. The original KrishiDisha field model reports 95.6% top-1 (v1, 1,650 field photos) and 94.3% (v2, 2,828 photos). Those weights are not distributed, so this deployment uses a public MobileNetV2 demo model (38 classes), and we clearly separate the two in the README.
The assistant's brain is selected by one setting, LLM_PROVIDER. For KisanConnect we connected Google's Gemini API through its OpenAI-compatible endpoint, which means swapping models is a configuration change, not a code change.
The important part is what sits around the model:
Farmers can type in Hindi or Hinglish and ask things like "mere khet me urea kitna daalu?", and the assistant routes the question to the dose calculator instead of improvising a number.
Everything above is also exposed as a JSON API under /api/v1/..., so an SMS or WhatsApp gateway can reach farmers without smartphones. The test suite runs fully offline with a stub disease model and an in-memory database, so pytest works on any laptop.
Procfile (gunicorn app:app), with SECRET_KEY, the admin credentials and the Gemini key set as environment variables.Innohacks 4.0 at KIET was Minecraft-themed ("We Learn, We Teach, We Conquer"), and our track was AI in Agriculture. Our team of four (Ujjwal Sharma, Aanya Malik, Nishita and Aastha) spent the event turning an open-source research project into something a farmer could actually use, reading model cards at odd hours and arguing about which number deserved to be on the slide.
If you have built for low-literacy or low-connectivity users, what would you add first? I'd love to hear it in the comments. 👇