https://github.com/rahul-120/crop_recom
This project is a Machine Learning based Crop Recommendation System built using Flask. It helps farmers or users decide the most suitable crop to grow based on soil nutrients and environmental conditions.
https://github.com/rahul-120/crop_recom
crop-recommendation-system flask flask-application machine-learning python3 scikit-learn
Last synced: about 2 months ago
JSON representation
This project is a Machine Learning based Crop Recommendation System built using Flask. It helps farmers or users decide the most suitable crop to grow based on soil nutrients and environmental conditions.
- Host: GitHub
- URL: https://github.com/rahul-120/crop_recom
- Owner: rahul-120
- License: mit
- Created: 2025-09-25T10:08:54.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-09-25T10:43:11.000Z (9 months ago)
- Last Synced: 2026-05-02T22:38:19.040Z (about 2 months ago)
- Topics: crop-recommendation-system, flask, flask-application, machine-learning, python3, scikit-learn
- Language: Python
- Homepage: https://mahesh2045-crop-recomd.hf.space/
- Size: 21.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
---
title: Crop Recomd
emoji: 🌱
colorFrom: green
colorTo: gray
sdk: docker
pinned: false
short_description: Machine Learning based Crop Recommendation System built using Flask
---
# 🌱 Crop Recommendation System
[](https://www.python.org/)
[](https://flask.palletsprojects.com/)
[](https://scikit-learn.org/)
[](http://mahesh2045-crop-recomd.hf.space/)
[](LICENSE)
This project is a **Machine Learning based Crop Recommendation System** built using **Flask**.
It helps farmers or users decide the most suitable crop to grow based on soil nutrients and environmental conditions.
🔗 **Live Demo**: [Crop Recommendation App](http://mahesh2045-crop-recomd.hf.space/)
---
## 📸 Screenshot

---
## 🚀 Features
- Predicts the best crop based on input values:
- 🌾 Nitrogen (N)
- 🌿 Phosphorus (P)
- 🌱 Potassium (K)
- 🌡️ Temperature
- 💧 Humidity
- ⚗️ pH
- ☔ Rainfall
- Simple and interactive **web interface** built with Flask.
- Model trained on agricultural datasets.
- Hosted online using **Hugging Face Spaces**.
---
## 🛠️ Tech Stack
- **Python**
- **Flask** (Web Framework)
- **NumPy** (Data Handling)
- **Pickle** (Model Serialization)
- **scikit-learn** (Machine Learning)
- **HTML/CSS** (Frontend)
- **Gunicorn** (Deployment on Hugging Face)
---
## 📂 Project Structure
```
├── app.py # Main Flask application
├── model.pkl # Trained ML model
├── requirements.txt # Dependencies
├── templates
│ └── index.html # Frontend HTML file
├── static/ # (Optional) For CSS/JS files
└── README.md # Project Documentation
````
---
## ⚙️ Installation & Usage
### 1. Clone the repository
```bash
git clone https://github.com/rahul-120/crop_recom.git
cd crop_recom
````
### 2. Create and activate a virtual environment (optional but recommended)
```bash
python -m venv venv
source venv/bin/activate # On macOS/Linux
venv\Scripts\activate # On Windows
```
### 3. Install dependencies
```bash
pip install -r requirements.txt
```
### 4. Run the Flask app
```bash
python app.py
```
### 5. Open in browser
Go to `http://127.0.0.1:5000/`
---
## 🧠 Model Details
* The model is trained to recommend the most suitable crop based on soil and weather conditions.
* It uses classification techniques from **scikit-learn** to map environmental features to a set of possible crops.
---
## 🌍 Deployment
* Hosted using **Hugging Face Spaces (Docker SDK)**
* Live App: [http://mahesh2045-crop-recomd.hf.space/](http://mahesh2045-crop-recomd.hf.space/)
---
## 📦 Requirements
`requirements.txt` (no versions for flexibility):
```
flask
gunicorn
scikit-learn
joblib
numpy
```
---
## 🤝 Contributing
Contributions are welcome! 🎉
1. Fork the repo
2. Create a new branch (`feature-xyz`)
3. Commit changes
4. Push to your branch
5. Open a Pull Request
---
## 📜 License
This project is licensed under the **MIT License**.
---
### 👨💻 Author
**Rahul Bhaskar**
🔗 [GitHub Profile](https://github.com/rahul-120)