SmartCropAdvisor is designed to help farmers, agri-tech users, and researchers identify the most suitable crop to grow under given soil and environmental conditions. The goal is to improve productivity and sustainability by leveraging machine learning for smart agriculture.
SmartCropAdvisor is a machine learning-powered web app built using Streamlit. It analyzes key input parameters like nitrogen, phosphorus, potassium levels, temperature, humidity, pH, and rainfall, and predicts the most suitable crop using a trained Decision Tree model.
The web interface provides a user-friendly experience where users can easily enter their environmental conditions and instantly get a crop recommendation.
- The dataset was loaded and checked for inconsistencies or missing values.
- Features were standardized using
StandardScalerto normalize the input range and improve model performance. - Inputs include:
- Nitrogen (N), Phosphorus (P), Potassium (K)
- Temperature, Humidity, pH, Rainfall
- Used a Decision Tree Classifier from
scikit-learn. - Trained the model using 80% of the dataset and tested on the remaining 20%.
- Serialized the model (
crop_model.pkl) and scaler (scaler.pkl) usingjoblibfor integration with the Streamlit app.
- Accuracy: Achieved 99% on test data.
- Chose Decision Tree for its interpretability and efficiency on this type of classification problem.
- Built the frontend using Streamlit.
- Deployed locally as a standalone web app.
- Simple and interactive UI with sliders for inputs and real-time output display.
- Frontend/UI: Streamlit
- Backend & Logic: Python
- Libraries Used:
pandas,numpy– Data processingscikit-learn– ML model and preprocessingjoblib– Saving the modelmatplotlib– For data visualization during EDAstreamlit– Web interface
SmartCropAdvisor/
├── Dataset/ # Folder containing the dataset
│ └── Crop_recommendation.csv # Main dataset used for training the model
├── .gitignore # Prevents Git from tracking unnecessary files
├── Crop_Recommendation_System.ipynb # Jupyter notebook for data analysis and model training
├── LICENSE # Allows reuse, with attribution, no warranty
├── README.md # Project documentation
├── app.py # Streamlit web application
├── crop_model.pkl # Trained Decision Tree Classifier model
├── requirements.txt # Python dependencies
└── scaler.pkl # StandardScaler object used for input scaling
This project is licensed under the MIT License.
Thanks for visiting ! Feel free to explore my other repositories and connect with me. 🚀