Skip to content

Here i completed my Crop Prediction Project using Machine Learning. Where i Basically built an application with streamlit and with the help of python fundamentals and i had attached my working of the project too.

Notifications You must be signed in to change notification settings

alisamad1/Crop_Recommendation_Project_Using_Machine_Learning

Repository files navigation

Crop Recommendation Project Using Machine Learning

Overview

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.

Features

  • 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.

Dataset

The project uses a public dataset containing:

  • Nitrogen (N) content
  • Phosphorous (P) content
  • Potassium (K) content
  • Temperature (°C)
  • Humidity (%)
  • pH value
  • Annual rainfall (mm)

Installation

  1. Clone the Repository git clone https://github.com/alisamad1/Crop_Recommendation_Project_Using_Machine_Learning.git cd Crop_Recommendation_Project_Using_Machine_Learning

  2. Set Up Environment python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate

  3. Install Required Libraries pip install -r requirements.txt

  4. Launch the Streamlit App streamlit run app.py

Technologies Used

  • Python
  • Jupyter Notebook
  • Flask
  • Streamlit
  • Scikit-learn
  • Pandas, NumPy

Project Structure

Crop_Recommendation_Project_Using_Machine_Learning/ ├── dataset/ │ └── crop_recommendation.csv ├── notebook/ │ └── Crop_Recommendation.ipynb ├── app.py ├── requirements.txt ├── README.md └── model/ └── trained_model.pkl

How It Works

  1. User enters environment and soil parameters in the Streamlit web UI.
  2. Application applies preprocessing and converts inputs to model-ready format.
  3. Trained machine learning model predicts the most suitable crop for the given inputs.
  4. Recommended crop (with supporting explanation) is displayed on the dashboard.

Results

  • 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.

Contributing

Contributions are welcome! Please fork the repository, create a pull request, and raise issues or suggestions via GitHub.

License

This project is released under the MIT License.


About

Here i completed my Crop Prediction Project using Machine Learning. Where i Basically built an application with streamlit and with the help of python fundamentals and i had attached my working of the project too.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published