An intelligent crop recommendation system that combines real-time weather data, soil analysis, and Gemini AI to suggest the most suitable crops for a given location.
- 📍 Pincode-based location detection (India Post API + Nominatim)
- 🌦️ Real-time weather data via Open-Meteo Archive API
- 🌱 Soil type mapping for Kerala regions
- 🤖 AI-powered crop recommendations using Google Gemini
- 💰 Budget-aware suggestions with cost, market price & profit range
- Frontend: Streamlit
- AI: Google Gemini API (
gemini-1.5-flash) - Weather: Open-Meteo Archive API
- Geocoding: India Post API + Nominatim (OpenStreetMap)
- Language: Python
- Clone the repo
git clone https://github.com/yourusername/ai-crop-prediction.git
cd ai-crop-prediction- Install dependencies
pip install streamlit requests google-genai- Add your Gemini API key to
.streamlit/secrets.toml
GOOGLE_API_KEY = "your_api_key_here"- Run the app
streamlit run app.py- User enters a pincode, season, and budget
- India Post API resolves pincode → district/state
- Nominatim geocodes district → lat/lon coordinates
- Open-Meteo fetches historical weather for the season
- Gemini AI generates 5 crop recommendations with cost & profit analysis
| API | Purpose |
|---|---|
| Google Gemini | Crop recommendations |
| Open-Meteo Archive | Historical weather data |
| India Post API | Pincode resolution |
| Nominatim (OSM) | Geocoding |