This project builds a machine learning–powered platform to recommend optimal crops for a given location based on environmental and soil parameters. Leveraging Python, Streamlit, and Flask, the application enables farmers, agronomists, and agricultural professionals to make informed decisions, thereby maximizing crop yield and profitability. The tool analyzes factors like soil nutrients, temperature, humidity, pH, and rainfall for precise recommendations.
- User Input Panel: Easily enter soil and climate data (N, P, K, temperature, humidity, pH, rainfall).
- Data Preprocessing: Handles missing values, normalizes features, and transforms categorical variables as required.
- Multiple ML Algorithms: Decision Trees, Random Forests, SVM, and Naive Bayes available for model building and deployment.
- Real-Time Crop Suggestions: Instantly receive recommendations for the most suitable crops, tailored to input parameters.
- Web Application: Streamlit-based intuitive dashboard paired with a Flask backend for seamless user experience.
The project uses a public dataset containing:
- Nitrogen (N) content
- Phosphorous (P) content
- Potassium (K) content
- Temperature (°C)
- Humidity (%)
- pH value
- Annual rainfall (mm)
-
Clone the Repository git clone https://github.com/alisamad1/Crop_Recommendation_Project_Using_Machine_Learning.git cd Crop_Recommendation_Project_Using_Machine_Learning
-
Set Up Environment python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Required Libraries pip install -r requirements.txt
-
Launch the Streamlit App streamlit run app.py
- Python
- Jupyter Notebook
- Flask
- Streamlit
- Scikit-learn
- Pandas, NumPy
Crop_Recommendation_Project_Using_Machine_Learning/ ├── dataset/ │ └── crop_recommendation.csv ├── notebook/ │ └── Crop_Recommendation.ipynb ├── app.py ├── requirements.txt ├── README.md └── model/ └── trained_model.pkl
- User enters environment and soil parameters in the Streamlit web UI.
- Application applies preprocessing and converts inputs to model-ready format.
- Trained machine learning model predicts the most suitable crop for the given inputs.
- Recommended crop (with supporting explanation) is displayed on the dashboard.
- Supports multiple crop varieties based on dynamic user inputs.
- Achieves high prediction accuracy using ensemble ML techniques.
- Deployable to local or cloud environments for real-world usability.
Contributions are welcome! Please fork the repository, create a pull request, and raise issues or suggestions via GitHub.
This project is released under the MIT License.