Spaces:
Running
title: Crop Recommendation System
emoji: πΎ
colorFrom: green
colorTo: yellow
sdk: docker
app_file: app.py
pinned: false
license: mit
πΎ Smart Farming: Crop Recommendation System for Popular Indian Crops
π¬ A Machine Learning-based Web Application to Recommend Suitable Crops Based on Environmental Conditions
π¨βπΎ Built by Saksham Pathak | IIIT Lucknow | 94.3% Accuracy | Deployed using Flask
π Overview
Smart Farming is a crop recommendation system that leverages machine learning to assist Indian farmers in selecting the most suitable crop for cultivation based on key environmental parameters. The system uses a Random Forest Classifier trained on soil and climatic data to suggest the best crop from a set of 22 popular Indian crops.
π± This project empowers sustainable agriculture, efficient resource utilization, and smarter farming decisions through AI.
π§ Key Features
- β ML-Powered Predictions (94.3% Accuracy)
- π§ͺ Inputs: Nitrogen, Phosphorus, Potassium, Temperature, Humidity, pH, Rainfall
- πΎ Outputs: Rice, Maize, Banana, Cotton, Sugarcane, etc.
- π Model Used: Random Forest Classifier
- π Flask-based Web App with real-time crop suggestions
- π¨ Clean and responsive UI (HTML + CSS + JS)
π Live Demo
π Link coming soon or hosted locally
π₯οΈ Tech Stack
| Component | Technology |
|---|---|
| π¨βπ» Language | Python, HTML, CSS, JS |
| π ML Model | Random Forest Classifier |
| βοΈ Backend | Flask (Python) |
| πΌ Frontend | HTML + CSS + JavaScript |
| π¦ Deployment | Pickle Model Serialization |
π Project Structure
π crop-recommendation
βββ π static/
β βββ images
βββ π templates/
β βββ index.html
βββ π app.py # Flask backend
βββ π crop\minmaxscaler.pkl,standscaler.pkl # Trained ML model
βββ π requirements.txt
βββ π Dockerfile
βββ π README.md
π Model Performance
| Model | Accuracy | Precision | Recall | F1-Score |
|---|---|---|---|---|
| π Random Forest | 94.3% | 92.7% | 91.5% | 92.1% |
| Gradient Boosting | 92.1% | 90.5% | 89.3% | 89.9% |
| XGBoost | 91.4% | 88.9% | 87.5% | 88.2% |
| SVM | 85.7% | 83.2% | 81.6% | 82.4% |
π Key Factors Influencing Prediction:
- Rainfall
- Soil pH
- Temperature
- NPK (Nitrogen, Phosphorus, Potassium)
π₯ How to Run Locally
1οΈβ£ Clone the Repository
git clone https://github.com/parthmax2/crop-recommendation-system.git
cd crop-recommendation-system
2οΈβ£ Install Dependencies
pip install -r requirements.txt
3οΈβ£ Run the Flask App
python app.py
4οΈβ£ Open in Browser
Visit http://localhost:5000/ to use the web app.
π Future Enhancements
- π€ Real-time Weather API Integration
- π‘ IoT-based Soil Sensor Integration
- π Pest & Disease Prediction Module
- π Satellite/GIS data for advanced insights
- π Multilingual and Offline Support
βοΈ Author
Saksham Pathak M.Sc. AI & ML, IIIT Lucknow π GitHub | LinkedIn
π License
This project is licensed under the MIT License β see the LICENSE file for details.
π References
- IEEE Paper 1
- Crop Dataset - Kaggle
- Full list of academic references is included in the
paper.pdf.
π± "Empowering farmers through AI-driven decisions for a greener tomorrow."