🚀 Live Project

🌐 Live Demo: https://code2crop-production.up.railway.app/

🎬 Demo Video: https://www.youtube.com/watch?v=QexPOJuS-g8

💻 GitHub Repository: https://github.com/gdhanushkumar07/Code2Crop.git

Inspiration

Farmers in drought-prone districts like Karimnagar, Peddapalli, and Siddipet in Telangana often choose what to grow based on habit or word-of-mouth, not on what the soil, groundwater, or weather can actually support. This leads to wasted water, failed yields, and mounting electricity bills from irrigation pumps run in the wrong season. We also noticed two recurring failure modes in existing solutions: government SMS advisories are generic and ignored, and most agricultural chatbots confidently give a diagnosis even when they shouldn't — a dangerous flaw when a farmer's entire harvest is on the line. We wanted to build something that gave farmers real, localized intelligence, and that knew when to say "I'm not sure, let me get you a human."

What it does

Code2Crop is an AI agricultural advisory platform with two sides:

  • For farmers: a web portal and a WhatsApp channel where they can ask crop questions in their own language — by text, voice, or photo. It recommends crops based on satellite vegetation health (NDVI), soil data, and rainfall history, comparing water need against local groundwater. It also diagnoses crop diseases from leaf photos using Gemini Vision.
  • For agricultural officers: an Operations Center dashboard where any AI diagnosis below a 65% confidence threshold is automatically escalated — with the farmer's photo, symptoms, and location — so a real expert at the nearest Rythu Seva Kendra (RSK) can step in before a farmer acts on an uncertain AI answer.

The result is a single system that's accessible to farmers with or without a smartphone, and that never lets an AI guess stand in for expert judgment when it isn't confident.

How we built it

We built Code2Crop on Next.js 16 (App Router) with React 19 and TypeScript, styled with Tailwind CSS and Framer Motion for a warm, farmer-friendly interface on one side and a dark ops-dashboard for officers on the other. Gemini 1.5 Flash powers both the text reasoning and vision-based disease diagnosis, orchestrated through a multi-step pipeline: voice input → speech-to-text → translation → Gemini reasoning → data grounding (satellite/weather/soil) → final advisory. For farmers without the app, we built a Twilio WhatsApp webhook that routes incoming messages and photos through the same Gemini pipeline, with full conversation history stored in Firebase Firestore so context carries across both the web and WhatsApp. The whole app is deployed on Railway/Vercel.

Challenges we ran into

  • Getting the AI to reliably self-assess its own confidence, so escalation actually triggers when it should rather than always answering with false certainty.
  • Keeping the WhatsApp and web experiences in sync — same AI logic, same escalation rule, same conversation memory, across two very different interfaces.
  • Designing two UIs with completely different emotional tones (a calm, reassuring farmer experience vs. a fast, information-dense officer dashboard) without them feeling like two different products.
  • Handling real-time-feeling case updates in the officer dashboard without over-engineering a full real-time backend under hackathon time constraints.

Accomplishments that we're proud of

  • A working human-escalation safety net — not just an AI chatbot, but a system that knows its own limits.
  • A genuinely dual-channel experience: the same intelligence reachable from a polished web app or a plain WhatsApp message.
  • An end-to-end pipeline from voice/photo input all the way to a grounded, explainable recommendation.

What we learned

We learned a lot about prompt design for confidence calibration, structuring multi-turn context for a conversational agent across two channels, and how much thoughtful UX (not just model quality) matters when the end user may not be comfortable with technology at all.

What's next for Code2Crop

  • Replacing simulated satellite data with a live Google Earth Engine integration
  • Expanding voice support to more regional dialects
  • Adding an SMS fallback for feature-phone users with no WhatsApp/data
  • Building out the interactive live demo console

Built With

  • firebase
  • firestore
  • framer-motion
  • gemini-ai
  • google-generative-ai
  • nextjs
  • react
  • react-hook-form
  • recharts
  • tailwindcss
  • twilio
  • typescript
  • vercel
  • whatsapp-business-api
Share this project:

Updates

Submission history