An AI-powered crop recommendation web app for Indian farmers — predicts the best crops for any city using real-time weather, NASA soil data, ICAR soil database, and Groq LLM for fertilizer, irrigation, and mandi price advice.
- 🌱 Crop Prediction — XGBoost ML model trained on 22+ crops with real soil & weather inputs
- 🌤️ Live Weather Integration — OpenWeatherMap API for real-time temperature, humidity & wind
- 🛰️ NASA POWER API — Daily rainfall and soil moisture data from satellite
- 🧪 ICAR Soil Database — City-specific N, P, K, pH values for 100+ Indian cities
- 🤖 Groq LLM Advice — AI-generated fertilizer schedules, irrigation plans & mandi prices
- 🍃 Leaf Disease Detection — Upload a leaf image for instant AI disease diagnosis
- 📅 12-Month Crop Calendar — Month-wise farming activity planner
- 🏪 Mandi Price Search — Real-time market price analysis with 30-day forecast
- 🌐 Multilingual Support — English, Telugu, and Hindi
- 🗺️ 50+ Extended Crops — Region + climate based recommendations beyond ML model
| Layer | Technology |
|---|---|
| Backend | Python, Flask |
| ML Model | XGBoost, Scikit-learn |
| AI / LLM | Groq API (LLaMA 3.3 70B + LLaMA 4 Scout Vision) |
| Weather | OpenWeatherMap API |
| Soil & Rain | NASA POWER API |
| Geocoding | Geopy (Nominatim) |
| Frontend | HTML, CSS, JavaScript, Jinja2 |
| Data | ICAR Soil DB, Custom Rainfall DB (120+ cities) |
Smart_Farmer_AI/
├── templates/ # HTML templates (Jinja2)
├── app.py # Main Flask application
├── shc_engine.py # Soil Health Card scraper engine
├── train_model.py # XGBoost model training script
├── xgb_model.pkl # Trained XGBoost model
├── encoder.pkl # Label encoder for crop classes
├── class_names.json # Crop class names
├── Crop_recommendation.csv # Training dataset
├── requirements.txt # Python dependencies
├── .gitignore # Git ignore rules
└── README.md # Project documentation
git clone https://github.com/GeethaBurigalla/Smart_Farmer_AI.git
cd Smart_Farmer_AIpip install -r requirements.txtCreate a .env file in the root directory:
GROQ_API_KEY=your_groq_api_key_here
WEATHER_API_KEY=your_openweathermap_api_key_here
🔑 Get your free API keys:
- Groq: https://console.groq.com
- OpenWeatherMap: https://openweathermap.org/api
python app.pyVisit http://127.0.0.1:5000 in your browser.
User enters city name
↓
Geocoding (Geopy) → lat/lon
↓
┌─────────────────────────────────┐
│ NASA POWER API → daily rain │
│ OpenWeatherMap → temp, humidity│
│ ICAR Soil DB → N, P, K, pH │
│ Annual Rain DB → annual mm │
└─────────────────────────────────┘
↓
XGBoost ML Model → Top 5 crop predictions
↓
Region + Climate Engine → 8 extended crops
↓
Groq LLM → Fertilizer / Irrigation / Mandi advice
↓
Result displayed in selected language
- Algorithm: XGBoost Classifier
- Dataset: Crop Recommendation Dataset (Kaggle)
- Features: N, P, K, Temperature, Humidity, pH, Rainfall
- Classes: 22 crops (Rice, Maize, Chickpea, Mango, Coconut, Coffee, etc.)
- Extended: 50+ crops via region + climate scoring engine
100+ Indian cities across all states including Hyderabad, Bengaluru, Mumbai, Delhi, Chennai, Kolkata, and more — each with curated ICAR soil data and annual rainfall values.
| Geetha Burigalla | @GeethaBurigalla | | Hruthika | @hruthika18 | | Heena Meharaj |
This project is licensed under the MIT License.
- NASA POWER API for satellite-based soil & weather data
- ICAR for soil health reference data
- Groq for blazing-fast LLM inference
- OpenWeatherMap for live weather data
- Kaggle Crop Recommendation Dataset