How nandakumar005/ai_crop_prediction works
AI Crop Prediction is a Flask application that combines submitted soil values and GPS coordinates with weather and location lookups, ranks suitable crops with a trained model, adds market estimates, and generates a comparison chart. Users can also request a separate Gemini farming advisory. The app and service calls are visible in the sampled source; UI interactions and some presentation details are based on the README, since the template was not sampled.
Main entry points: app.py Flask API · index.html Web Interface · crop_service.py Crop Ranking · weather_data.py Weather Lookup
Components 14
Web Workflow
- Web Interface
templates/index.html - Flask API
app.py
Crop Prediction
- Crop Ranking
services/crop_service.py - Trained Model
models/crop_recommendation_model.pkl
Farm Context
- Weather Lookup
services/weather_data.py - OpenWeatherMap
- Reverse Geocoding
services/location_service.py - Nominatim
Market And Advice
- Price Estimation
services/market_service.py - data.gov API
- Price Chart
app.py - Advisory Service
services/gemini_service.py - Google Gemini
Other components
- Farmer
Connections 18
- Farmer → Web Interface: enters inputs
README.md - Web Interface → Flask API: submits analysis
README.md - Flask API → Web Interface: renders interface
app.py - Flask API → Weather Lookup: fetches weather
app.py - Weather Lookup → OpenWeatherMap: requests conditions
services/weather_data.py - Flask API → Reverse Geocoding: fetches location
app.py - Reverse Geocoding → Nominatim: reverse geocodes
services/location_service.py - Flask API → Crop Ranking: ranks crops
app.py - Crop Ranking → Trained Model: loads probabilities
services/crop_service.py - Flask API → Price Estimation: prices crops
app.py - Price Estimation → data.gov API: requests prices
services/market_service.py - Flask API → Price Chart: builds chart
app.py - Flask API → Web Interface: returns results
README.md - Farmer → Web Interface: requests advice
README.md - Web Interface → Flask API: posts advisory data
README.md - Flask API → Advisory Service: requests summary
app.py - Advisory Service → Google Gemini: generates advice
services/gemini_service.py - Flask API → Web Interface: returns advisory
app.py