Inspiration

100M+ farmers frequently face three recurring hurdles: identifying crop diseases in time, planning day-to-day farm activities under uncertain weather, and making financially sound decisions without reliable guidance in their local language. We built Raitha Mitra to turn a smartphone into a 24×7 farm companion that understands crops, speaks the farmer's language, and recommends the next best action—practically and responsibly.

What It Does

Raitha Mitra is an AI-powered farming assistant that:

  • Detects crop diseases from images across 38 classes with 95% accuracy, then explains symptoms, yield impact, and organic/chemical treatments.
  • Runs a smart chat assistant with context memory in 10 Indian languages for farm Q&A and translation.
  • Generates weekly farm schedules (irrigation, fertilizer, pest control, harvesting) that adapt to live weather.
  • Provides predictive yield analytics with confidence scores and harvest timelines.
  • Computes a financial health score (0–100), tracks expenses, and suggests cost optimizations.
  • Builds a farmer network with messaging, privacy-aware community maps, and regional statistics.

How We Built It

Architecture: Modular Flask backend with discrete service layers (chat, farm planner, yield, finance, map), a TensorFlow CNN for disease detection, and a clean, responsive HTML/Tailwind/Vanilla-JS frontend.

Core Stack:

  • Backend: Python 3.11, Flask 3.1, Gunicorn
  • AI/ML: TensorFlow 2.20 (CNN, 148 MB .h5), Pillow/NumPy, Gemini integration for guidance/translation
  • Data: SQLite (14 tables, FK relationships, indexes), Leaflet + OSM for maps
  • Frontend: Jinja2 templates, TailwindCSS, modular JS (auth, detection, chat, planner, yield, finance, map, notifications)
  • Ops: Render-ready deployment (Procfile, render.yaml), Git LFS for large model/video assets

Numbers That Matter:

  • ≈ 18,000 LOC | 100+ API endpoints | 14 DB tables
  • Disease inference ≈ 132 ms per image (local CNN)
  • Chat/advice via Gemini with 15s timeout + fallbacks
  • Current DB size ≈ 264 KB (seed data), tested on free-tier infra

Challenges We Ran Into

  • Large model assets on free hosting → solved with Git LFS + custom build.sh + staged loading to reduce cold-start delay.
  • Language fidelity across 10 languages → added context windows and fallbacks to avoid mixed responses.
  • Data privacy vs social features → granular location privacy levels and sanitized inputs throughout.
  • Latency hotspots → cached model at startup and rate-limited AI endpoints.

Accomplishments We're Proud Of

  • Production-grade platform that blends on-device vision and cloud intelligence.
  • End-to-end multilingual UX — UI + chat + treatment guidance in 10 languages.
  • Privacy-first farmer community layer with maps and regional stats.
  • Clean Render deployment with health-check endpoint and guides.

What We Learned

  • Balance is everything — edge inference for speed + cloud LLMs for context.
  • Localization ≠ translation — agri-specific structured prompts build trust.
  • Design for constraints — bandwidth and free-tier limits drive real-world engineering.

What's Next

  1. IoT integration (soil moisture/weather stations) for real-time updates.
  2. Marketplace and expert network for verified inputs and consults.
  3. Offline-first PWA/mobile app (React Native/Flutter).
  4. Insurance & loan pathways using financial health scores.
  5. Expanded models for more crops and regional variants.

Impact

  • Timely diagnosis reduces avoidable yield loss.
  • Weather-aware planning turns uncertainty into action.
  • Financial insights guide better market timing.
  • Community features share local knowledge while preserving privacy.

Technical Deep Dive (At a Glance)

  • Vision Model: TensorFlow/Keras CNN (128 × 128 × 3), 38 classes; PIL/NumPy pre/post-processing; ≈ 132 ms inference.
  • Services: chat_service.py, farm_service.py, yield_service.py, finance_service.py, map_service.py.
  • Database: database.py with 50+ methods; tables for users, predictions, chats, farm activities, finance, etc.
  • Frontend: 12 Jinja pages + modular JS (Tailwind UI).
  • Deploy: Procfile + render.yaml (Gunicorn × 2 workers, Git LFS assets, health endpoint).

Responsible AI, Privacy & Security

  • Full input sanitization and validation.
  • Werkzeug password hashing + HTTPOnly cookies + secure sessions.
  • Granular location privacy controls and minimal logging.
  • Rate limits on AI endpoints to control abuse and latency.

How to Try It

  • Create an account or use demo credentials (if provided).
  • Upload a clear leaf image → view disease type, confidence, and treatment.
  • Open the planner → generate weekly schedule → toggle weather-aware guidance.
  • Explore yield prediction & financial score → add expenses to see insights.
  • Visit the community map → set privacy to district/state → browse regional stats.

Note: This application is hosted on Render and uses a large AI model with multiple modules. If the site seems slow to load, please wait for some time while the server initializes and the model loads completely. It will start automatically once ready. For smoother performance and more accurate predictions, you can also run the project locally using your own Gemini API key and Weather API key. Running locally ensures faster inference, reduced latency, and cleaner model outputs for real-time disease detection and forecasting. If you experience delays or limited functionality in the deployed version, we recommend using the local setup for the best experience and for AI for Social Good.

Built With

Share this project:

Updates