A Deep Learning + Machine Learning-based system for crop disease detection, crop recommendation, and fertilizer recommendation.
CropAI is a fully integrated, end-to-end AI system for farmers that can:
- Detect crop disease from an image
- Recommend the best crop based on soil & climate parameters
- Recommend the right fertilizer based on crop, soil type, nutrients
Includes:
- ML + DL Models
- FastAPI Backend
- Streamlit Dashboard
- Cloud Deployment
- (Mobile app coming soon)
- Trained MobileNetV2 on the PlantVillage dataset
- Input: leaf image
- Output: disease label + confidence
API Endpoint: POST /predict-disease
Example Response:
{
"predicted_class_index": 14,
"disease_label": "Tomato___Early_blight",
"confidence": 0.83
}Uses soil & climate parameters:
- N, P, K
- Temperature
- Humidity
- pH
- Rainfall
API Endpoint: POST /recommend-crop
Example Response:
{
"recommended_crop": "rice"
}Based on:
- Temperature, Humidity, Moisture
- Soil Type, Crop Type
- N, P, K
API Endpoint: POST /recommend-fertilizer
Example Response:
{
"recommended_fertilizer": "Urea"
}graph TD
A["PlantVillage Image Dataset"] --> B["Crop Disease Model (MobileNetV2)"]
C["Crop & Fertilizer Datasets"] --> D["Tabular ML Models"]
B --> E["Saved Models Folder"]
D --> E
E --> F["FastAPI Backend"]
F --> G["Streamlit Dashboard"]
F --> H["Mobile App (Future)"]
F --> I["Cloud Deployment (Render/AWS/Railway)"]
The backend is publicly deployed via Render.
- Base URL:
https://cropai-project.onrender.com/ - Swagger Docs:
https://cropai-project.onrender.com/docs
β οΈ Note: Render free tier sleeps when idle. First request may take 20β40 seconds.
Check server status.
Response:
{ "status": "ok" }Predict disease from uploaded image.
Body: multipart form-data β file
Response example:
{
"predicted_class_index": 14,
"disease_label": "Tomato___Early_blight",
"confidence": 0.83
}Body:
{
"N": 90,
"P": 42,
"K": 43,
"temperature": 22.0,
"humidity": 80.0,
"ph": 6.5,
"rainfall": 200.0
}Response:
{ "recommended_crop": "rice" }Body:
{
"Temparature": 26.0,
"Humidity": 52.0,
"Moisture": 38.0,
"Soil_Type": "Loamy",
"Crop_Type": "Sugarcane",
"Nitrogen": 50.0,
"Potassium": 40.0,
"Phosphorous": 40.0
}Response:
{ "recommended_fertilizer": "Urea" }All screenshots are stored in the /screenshots folder on GitHub.
conda create -n cropai python=3.10
conda activate cropai
pip install -r requirements.txtcd backend
uvicorn main:app --reload --host 0.0.0.0 --port 8000cd dashboard
streamlit run app.py- Better disease classification accuracy
- More crops & fertilizers
- Full mobile app (Flutter)
- Multi-language farmer UI
- Deployment across scalable cloud infra
- Improve accuracy with heavy fine-tuning
- Deploy backend + dashboard to Render/Railway/AWS
- Add real-time weather API integration
- Build farmer login + recommendation history
This project is licensed under the MIT License. Feel free to use it, modify it, and build upon it with proper attribution.
This project demonstrates:
- π§ Deep Learning (CV with MobileNetV2)
- π Machine Learning (RandomForest, preprocessing)
- βοΈ API engineering (FastAPI, Pydantic, CORS)
- π₯οΈ Interactive dashboards (Streamlit)
- π§© Full end-to-end design (data β model β API β UI)
- π§± Production-ready architecture
Perfect for:
- Resume
- LinkedIn posts
- Interviews
- Final-year projects
- ML engineering portfolios
Akhil Saurabh





