--- 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](https://github.com/parthmax2) | 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 [![Watch Demo](https://img.shields.io/badge/Click%20Here-Live%20App-green?style=for-the-badge&logo=github)](https://your-deployment-link.com) *๐Ÿ”’ 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 ```bash git clone https://github.com/parthmax2/crop-recommendation-system.git cd crop-recommendation-system ```` ### 2๏ธโƒฃ Install Dependencies ```bash pip install -r requirements.txt ``` ### 3๏ธโƒฃ Run the Flask App ```bash 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](https://github.com/parthmax2) | [LinkedIn](https://linkedin.com/in/sakshampathak) --- ## ๐Ÿ“„ License This project is licensed under the **MIT License** โ€“ see the [LICENSE](LICENSE) file for details. --- ## ๐Ÿ“š References * [IEEE Paper 1](https://ieeexplore.ieee.org/document/10575152) * [Crop Dataset - Kaggle](https://www.kaggle.com/datasets/atharvaingle/crop-recommendation-dataset) * Full list of academic references is included in the `paper.pdf`. --- > ๐ŸŒฑ *"Empowering farmers through AI-driven decisions for a greener tomorrow."* ```