Spaces:
Sleeping
Sleeping
Commit
·
5b80137
0
Parent(s):
initial commit
Browse files- .gitattributes +3 -0
- Dockerfile +17 -0
- README.md +142 -0
- app.py +78 -0
- models/minmaxscaler.pkl +3 -0
- models/model.pkl +3 -0
- models/standscaler.pkl +3 -0
- notebook/crop-recommendation-classification.ipynb +0 -0
- requirements.txt +11 -0
- static/apple.jpg +3 -0
- static/banana.jpg +3 -0
- static/blackgram.jpg +3 -0
- static/chickpea.jpg +3 -0
- static/coconut.jpg +3 -0
- static/coffee.jpg +3 -0
- static/cotton.jpg +3 -0
- static/farm.jpg +3 -0
- static/grapes.jpg +3 -0
- static/jute.jpg +3 -0
- static/kidneybeans.jpg +3 -0
- static/lentil.jpg +3 -0
- static/logo.png +3 -0
- static/maize.jpg +3 -0
- static/mango.jpg +3 -0
- static/mothbeans.jpg +3 -0
- static/mungbean.jpg +3 -0
- static/muskmelon.jpg +3 -0
- static/orange.jpg +3 -0
- static/papaya.jpg +3 -0
- static/pigeonpeas.jpg +3 -0
- static/pomegranate.jpg +3 -0
- static/rice.jpg +3 -0
- static/watermelon.jpg +3 -0
- templates/index.html +737 -0
.gitattributes
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
Dockerfile
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use an official lightweight Python image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Set working directory
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Copy project files
|
| 8 |
+
COPY . .
|
| 9 |
+
|
| 10 |
+
# Install dependencies
|
| 11 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
+
|
| 13 |
+
# Expose the port the app runs on
|
| 14 |
+
EXPOSE 7860
|
| 15 |
+
|
| 16 |
+
# Run the Flask app
|
| 17 |
+
CMD ["python", "app.py"]
|
README.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# 🌾 Smart Farming: Crop Recommendation System for Popular Indian Crops
|
| 3 |
+
|
| 4 |
+
> 🔬 A Machine Learning-based Web Application to Recommend Suitable Crops Based on Environmental Conditions
|
| 5 |
+
> 👨🌾 Built by [Saksham Pathak](https://github.com/parthmax2) | IIIT Lucknow | 94.3% Accuracy | Deployed using Flask
|
| 6 |
+
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
## 📌 Overview
|
| 10 |
+
|
| 11 |
+
**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**.
|
| 12 |
+
|
| 13 |
+
🌱 This project empowers sustainable agriculture, efficient resource utilization, and smarter farming decisions through AI.
|
| 14 |
+
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
## 🧠 Key Features
|
| 18 |
+
|
| 19 |
+
- ✅ **ML-Powered Predictions** (94.3% Accuracy)
|
| 20 |
+
- 🧪 Inputs: Nitrogen, Phosphorus, Potassium, Temperature, Humidity, pH, Rainfall
|
| 21 |
+
- 🌾 Outputs: Rice, Maize, Banana, Cotton, Sugarcane, etc.
|
| 22 |
+
- 📊 Model Used: **Random Forest Classifier**
|
| 23 |
+
- 🌐 **Flask-based Web App** with real-time crop suggestions
|
| 24 |
+
- 🎨 Clean and responsive UI (HTML + CSS + JS)
|
| 25 |
+
|
| 26 |
+
---
|
| 27 |
+
|
| 28 |
+
## 🚀 Live Demo
|
| 29 |
+
|
| 30 |
+
[](https://your-deployment-link.com)
|
| 31 |
+
*🔒 Link coming soon or hosted locally*
|
| 32 |
+
|
| 33 |
+
---
|
| 34 |
+
|
| 35 |
+
## 🖥️ Tech Stack
|
| 36 |
+
|
| 37 |
+
| Component | Technology |
|
| 38 |
+
|---------------|---------------------------|
|
| 39 |
+
| 👨💻 Language | Python, HTML, CSS, JS |
|
| 40 |
+
| 🔍 ML Model | Random Forest Classifier |
|
| 41 |
+
| ⚙️ Backend | Flask (Python) |
|
| 42 |
+
| 🖼 Frontend | HTML + CSS + JavaScript |
|
| 43 |
+
| 📦 Deployment | Pickle Model Serialization |
|
| 44 |
+
|
| 45 |
+
---
|
| 46 |
+
|
| 47 |
+
## 📂 Project Structure
|
| 48 |
+
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
📁 crop-recommendation
|
| 52 |
+
├── 📁 static/
|
| 53 |
+
│ └── images
|
| 54 |
+
├── 📁 templates/
|
| 55 |
+
│ └── index.html
|
| 56 |
+
├── 📄 app.py # Flask backend
|
| 57 |
+
├── 📄 crop\minmaxscaler.pkl,standscaler.pkl # Trained ML model
|
| 58 |
+
├── 📄 requirements.txt
|
| 59 |
+
├── 📄 Dockerfile
|
| 60 |
+
└── 📄 README.md
|
| 61 |
+
````
|
| 62 |
+
|
| 63 |
+
---
|
| 64 |
+
|
| 65 |
+
## 📊 Model Performance
|
| 66 |
+
|
| 67 |
+
| Model | Accuracy | Precision | Recall | F1-Score |
|
| 68 |
+
|------------------|----------|-----------|--------|----------|
|
| 69 |
+
| 🌟 Random Forest | 94.3% | 92.7% | 91.5% | 92.1% |
|
| 70 |
+
| Gradient Boosting | 92.1% | 90.5% | 89.3% | 89.9% |
|
| 71 |
+
| XGBoost | 91.4% | 88.9% | 87.5% | 88.2% |
|
| 72 |
+
| SVM | 85.7% | 83.2% | 81.6% | 82.4% |
|
| 73 |
+
|
| 74 |
+
📌 **Key Factors Influencing Prediction:**
|
| 75 |
+
- Rainfall
|
| 76 |
+
- Soil pH
|
| 77 |
+
- Temperature
|
| 78 |
+
- NPK (Nitrogen, Phosphorus, Potassium)
|
| 79 |
+
|
| 80 |
+
---
|
| 81 |
+
|
| 82 |
+
## 📥 How to Run Locally
|
| 83 |
+
|
| 84 |
+
### 1️⃣ Clone the Repository
|
| 85 |
+
```bash
|
| 86 |
+
git clone https://github.com/parthmax2/crop-recommendation-system.git
|
| 87 |
+
cd crop-recommendation-system
|
| 88 |
+
````
|
| 89 |
+
|
| 90 |
+
### 2️⃣ Install Dependencies
|
| 91 |
+
|
| 92 |
+
```bash
|
| 93 |
+
pip install -r requirements.txt
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
### 3️⃣ Run the Flask App
|
| 97 |
+
|
| 98 |
+
```bash
|
| 99 |
+
python app.py
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
### 4️⃣ Open in Browser
|
| 103 |
+
|
| 104 |
+
Visit `http://localhost:5000/` to use the web app.
|
| 105 |
+
|
| 106 |
+
---
|
| 107 |
+
|
| 108 |
+
## 📈 Future Enhancements
|
| 109 |
+
|
| 110 |
+
* [ ] 🌤 Real-time Weather API Integration
|
| 111 |
+
* [ ] 📡 IoT-based Soil Sensor Integration
|
| 112 |
+
* [ ] 🐛 Pest & Disease Prediction Module
|
| 113 |
+
* [ ] 🌍 Satellite/GIS data for advanced insights
|
| 114 |
+
* [ ] 🌐 Multilingual and Offline Support
|
| 115 |
+
|
| 116 |
+
---
|
| 117 |
+
|
| 118 |
+
## ✍️ Author
|
| 119 |
+
|
| 120 |
+
**Saksham Pathak**
|
| 121 |
+
M.Sc. AI & ML, IIIT Lucknow
|
| 122 |
+
🔗 [GitHub](https://github.com/parthmax2) | [LinkedIn](https://linkedin.com/in/sakshampathak)
|
| 123 |
+
|
| 124 |
+
---
|
| 125 |
+
|
| 126 |
+
## 📄 License
|
| 127 |
+
|
| 128 |
+
This project is licensed under the **MIT License** – see the [LICENSE](LICENSE) file for details.
|
| 129 |
+
|
| 130 |
+
---
|
| 131 |
+
|
| 132 |
+
## 📚 References
|
| 133 |
+
|
| 134 |
+
* [IEEE Paper 1](https://ieeexplore.ieee.org/document/10575152)
|
| 135 |
+
* [Crop Dataset - Kaggle](https://www.kaggle.com/datasets/atharvaingle/crop-recommendation-dataset)
|
| 136 |
+
* Full list of academic references is included in the `paper.pdf`.
|
| 137 |
+
|
| 138 |
+
---
|
| 139 |
+
|
| 140 |
+
> 🌱 *"Empowering farmers through AI-driven decisions for a greener tomorrow."*
|
| 141 |
+
|
| 142 |
+
```
|
app.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from flask import Flask, request, render_template, url_for
|
| 2 |
+
import numpy as np
|
| 3 |
+
import pickle
|
| 4 |
+
|
| 5 |
+
# Load model and scalers
|
| 6 |
+
model = pickle.load(open('models/model.pkl', 'rb'))
|
| 7 |
+
sc = pickle.load(open('models/standscaler.pkl', 'rb'))
|
| 8 |
+
ms = pickle.load(open('models/minmaxscaler.pkl', 'rb'))
|
| 9 |
+
|
| 10 |
+
app = Flask(__name__)
|
| 11 |
+
|
| 12 |
+
# List of all crops with details, pointing to images in the 'static' folder
|
| 13 |
+
crops = [
|
| 14 |
+
{"name": "Rice", "image": "rice.jpg", "description": "Rice is a staple crop grown primarily in flooded fields. It thrives in hot, humid climates with regular rainfall."},
|
| 15 |
+
{"name": "Maize", "image": "maize.jpg", "description": "Maize (corn) is versatile, used for food, livestock feed, and industrial products, best grown in well-drained soil with moderate rainfall."},
|
| 16 |
+
{"name": "Jute", "image": "jute.jpg", "description": "Jute is a fiber crop used for burlap sacks, ropes, and mats, and it grows best in warm, wet conditions."},
|
| 17 |
+
{"name": "Cotton", "image": "cotton.jpg", "description": "Cotton is a cash crop grown in warm climates; its fibers make textiles, and seeds are processed for oil."},
|
| 18 |
+
{"name": "Coconut", "image": "coconut.jpg", "description": "Coconut is grown in tropical regions for coconuts, oil, and coir, best in sandy soil with sunlight and rainfall."},
|
| 19 |
+
{"name": "Papaya", "image": "papaya.jpg", "description": "Papaya is a tropical fruit thriving in warm climates, rich in vitamins, grown commercially and locally."},
|
| 20 |
+
{"name": "Orange", "image": "orange.jpg", "description": "Oranges are rich in vitamin C, growing best in warm climates with well-drained soil and moderate rainfall."},
|
| 21 |
+
{"name": "Apple", "image": "apple.jpg", "description": "Apple trees grow in temperate climates, require cold winters and well-drained, loamy soil to produce quality fruit."},
|
| 22 |
+
{"name": "Muskmelon", "image": "muskmelon.jpg", "description": "Muskmelon is a sweet fruit needing sunlight, moderate rainfall, and well-drained soil, popular for its refreshing taste."},
|
| 23 |
+
{"name": "Watermelon", "image": "watermelon.jpg", "description": "Watermelon thrives in warm seasons, needing high temperatures and plenty of water, grown for its juicy, sweet fruit."},
|
| 24 |
+
{"name": "Grapes", "image": "grapes.jpg", "description": "Grapes are grown for fresh consumption and wine, needing temperate climates with well-drained soil and moderate rainfall."},
|
| 25 |
+
{"name": "Mango", "image": "mango.jpg", "description": "Mango is a tropical fruit tree, thriving in hot, humid climates, needing well-drained, sandy loam soil with sun exposure."},
|
| 26 |
+
{"name": "Banana", "image": "banana.jpg", "description": "Bananas grow in tropical areas, thriving in hot, humid climates with regular rainfall and well-drained soil."},
|
| 27 |
+
{"name": "Pomegranate", "image": "pomegranate.jpg", "description": "Pomegranate grows best in dry climates, rich in antioxidants, cultivated for fresh consumption and juice production."},
|
| 28 |
+
{"name": "Lentil", "image": "lentil.jpg", "description": "Lentil is a protein-rich legume grown in temperate regions, important for crop rotation due to nitrogen fixation."},
|
| 29 |
+
{"name": "Blackgram", "image": "blackgram.jpg", "description": "Blackgram is a legume crop in tropical areas, an essential protein source in South Asia for curries and dals."},
|
| 30 |
+
{"name": "Mungbean", "image": "mungbean.jpg", "description": "Mungbean is grown for its small, green seeds, thriving in warm climates, commonly used in cooking."},
|
| 31 |
+
{"name": "Mothbeans", "image": "mothbeans.jpg", "description": "Mothbeans are drought-resistant legumes in arid areas, used in curries and soups."},
|
| 32 |
+
{"name": "Pigeonpeas", "image": "pigeonpeas.jpg", "description": "Pigeonpeas are legumes in tropical regions, important for food security due to their high protein content."},
|
| 33 |
+
{"name": "Kidneybeans", "image": "kidneybeans.jpg", "description": "Kidney beans are protein-rich, grown in warm seasons with fertile, well-drained soil."},
|
| 34 |
+
{"name": "Chickpea", "image": "chickpea.jpg", "description": "Chickpea is a pulse crop in semi-arid regions, a major source of plant protein, improving soil health in rotation."},
|
| 35 |
+
{"name": "Coffee", "image": "coffee.jpg", "description": "Coffee is a tropical crop grown in high-altitude areas for its seeds, used in the popular beverage."}
|
| 36 |
+
]
|
| 37 |
+
|
| 38 |
+
@app.route('/')
|
| 39 |
+
def index():
|
| 40 |
+
return render_template("index.html")
|
| 41 |
+
|
| 42 |
+
@app.route("/predict", methods=['POST'])
|
| 43 |
+
def predict():
|
| 44 |
+
# Get form input values
|
| 45 |
+
N = request.form['Nitrogen']
|
| 46 |
+
P = request.form['Phosporus']
|
| 47 |
+
K = request.form['Potassium']
|
| 48 |
+
temp = request.form['Temperature']
|
| 49 |
+
humidity = request.form['Humidity']
|
| 50 |
+
ph = request.form['Ph']
|
| 51 |
+
rainfall = request.form['Rainfall']
|
| 52 |
+
|
| 53 |
+
# Prepare features for prediction
|
| 54 |
+
feature_list = [N, P, K, temp, humidity, ph, rainfall]
|
| 55 |
+
single_pred = np.array(feature_list).reshape(1, -1)
|
| 56 |
+
scaled_features = ms.transform(single_pred)
|
| 57 |
+
final_features = sc.transform(scaled_features)
|
| 58 |
+
prediction = model.predict(final_features)[0] # Predict crop
|
| 59 |
+
|
| 60 |
+
# Map prediction result to crop details
|
| 61 |
+
crop_dict = {
|
| 62 |
+
1: "Rice", 2: "Maize", 3: "Jute", 4: "Cotton", 5: "Coconut",
|
| 63 |
+
6: "Papaya", 7: "Orange", 8: "Apple", 9: "Muskmelon", 10: "Watermelon",
|
| 64 |
+
11: "Grapes", 12: "Mango", 13: "Banana", 14: "Pomegranate", 15: "Lentil",
|
| 65 |
+
16: "Blackgram", 17: "Mungbean", 18: "Mothbeans", 19: "Pigeonpeas",
|
| 66 |
+
20: "Kidneybeans", 21: "Chickpea", 22: "Coffee"
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
# Find crop details
|
| 70 |
+
crop_name = crop_dict.get(prediction, "Unknown Crop")
|
| 71 |
+
crop_info = next((crop for crop in crops if crop['name'] == crop_name), None)
|
| 72 |
+
|
| 73 |
+
return render_template('index.html', crop=crop_info)
|
| 74 |
+
|
| 75 |
+
if __name__ == "__main__":
|
| 76 |
+
app.run(host='0.0.0.0', port=7860, debug=False)
|
| 77 |
+
|
| 78 |
+
|
models/minmaxscaler.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8b16e71aa8a6b85f91c581a51b10dfc65352530530a405c8395463576cd9475c
|
| 3 |
+
size 760
|
models/model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c3aabece3318a462b317f4f3be1e60a4edf5d4403caaff47d4667702c402b92e
|
| 3 |
+
size 3584496
|
models/standscaler.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:034d859860b10c9e2f3f3fd06cadb7a274488a2fb90be8262c20b5351ebccf4f
|
| 3 |
+
size 617
|
notebook/crop-recommendation-classification.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
requirements.txt
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Flask==3.1.0
|
| 2 |
+
gunicorn==23.0.0
|
| 3 |
+
Jinja2==3.1.4
|
| 4 |
+
Werkzeug==3.1.3
|
| 5 |
+
|
| 6 |
+
numpy==2.1.3
|
| 7 |
+
pandas==2.2.3
|
| 8 |
+
scikit-learn==1.5.2
|
| 9 |
+
scipy==1.14.1
|
| 10 |
+
joblib==1.4.2
|
| 11 |
+
threadpoolctl==3.5.0
|
static/apple.jpg
ADDED
|
Git LFS Details
|
static/banana.jpg
ADDED
|
Git LFS Details
|
static/blackgram.jpg
ADDED
|
Git LFS Details
|
static/chickpea.jpg
ADDED
|
Git LFS Details
|
static/coconut.jpg
ADDED
|
Git LFS Details
|
static/coffee.jpg
ADDED
|
Git LFS Details
|
static/cotton.jpg
ADDED
|
Git LFS Details
|
static/farm.jpg
ADDED
|
Git LFS Details
|
static/grapes.jpg
ADDED
|
Git LFS Details
|
static/jute.jpg
ADDED
|
Git LFS Details
|
static/kidneybeans.jpg
ADDED
|
Git LFS Details
|
static/lentil.jpg
ADDED
|
Git LFS Details
|
static/logo.png
ADDED
|
Git LFS Details
|
static/maize.jpg
ADDED
|
Git LFS Details
|
static/mango.jpg
ADDED
|
Git LFS Details
|
static/mothbeans.jpg
ADDED
|
Git LFS Details
|
static/mungbean.jpg
ADDED
|
Git LFS Details
|
static/muskmelon.jpg
ADDED
|
Git LFS Details
|
static/orange.jpg
ADDED
|
Git LFS Details
|
static/papaya.jpg
ADDED
|
Git LFS Details
|
static/pigeonpeas.jpg
ADDED
|
Git LFS Details
|
static/pomegranate.jpg
ADDED
|
Git LFS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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!doctype html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
| 7 |
+
<title>Crop Recommendation System</title>
|
| 8 |
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet">
|
| 9 |
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet">
|
| 10 |
+
<!-- Font Awesome CDN for social icons -->
|
| 11 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 12 |
+
<style>
|
| 13 |
+
html {
|
| 14 |
+
scroll-behavior: smooth;
|
| 15 |
+
/* Ensures smooth scrolling */
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
body {
|
| 19 |
+
background: url('/static/farm.jpg') no-repeat center center fixed;
|
| 20 |
+
background-size: cover;
|
| 21 |
+
font-family: 'Arial', sans-serif;
|
| 22 |
+
color: #fff;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
.navbar {
|
| 26 |
+
position: fixed;
|
| 27 |
+
/* Make the navbar fixed at the top */
|
| 28 |
+
top: 0;
|
| 29 |
+
left: 0;
|
| 30 |
+
right: 0;
|
| 31 |
+
background-color: #0a7a35;
|
| 32 |
+
/* Dark green */
|
| 33 |
+
z-index: 1000;
|
| 34 |
+
/* Ensure the navbar is on top of other elements */
|
| 35 |
+
padding: 10px 0;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
.navbar-brand {
|
| 39 |
+
font-size: 1.5rem;
|
| 40 |
+
font-weight: bold;
|
| 41 |
+
color: #fff !important;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
.nav-link {
|
| 45 |
+
color: #fff !important;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
.navbar-nav a:hover {
|
| 49 |
+
color: #47e684 !important;
|
| 50 |
+
/* Light green on hover */
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
h1 {
|
| 54 |
+
font-size: 3.5rem;
|
| 55 |
+
/* Initial font size */
|
| 56 |
+
text-align: center;
|
| 57 |
+
color: #ffffff;
|
| 58 |
+
font-weight: bold;
|
| 59 |
+
text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.6);
|
| 60 |
+
/* Adding shadow for depth */
|
| 61 |
+
margin-top: 20vh;
|
| 62 |
+
/* Position it lower down for better visibility */
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
/* Logo Styling */
|
| 66 |
+
.logo-img {
|
| 67 |
+
width: 10%;
|
| 68 |
+
/* Initially 10% of the screen width */
|
| 69 |
+
height: auto;
|
| 70 |
+
text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.6);
|
| 71 |
+
vertical-align: middle;
|
| 72 |
+
margin-left: 10px;
|
| 73 |
+
/* Space between text and logo */
|
| 74 |
+
display: inline-block;
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
.card {
|
| 78 |
+
background-color: #ecf0f1;
|
| 79 |
+
border: none;
|
| 80 |
+
border-radius: 10px;
|
| 81 |
+
transition: transform 0.2s, box-shadow 0.2s;
|
| 82 |
+
margin: 20px 0;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
.card:hover {
|
| 86 |
+
transform: translateY(-5px);
|
| 87 |
+
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
.card-title {
|
| 91 |
+
color: #2c3e50;
|
| 92 |
+
font-weight: bold;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
.form-container {
|
| 97 |
+
background-color: #b5f4cde4;
|
| 98 |
+
/* Light green background */
|
| 99 |
+
padding: 30px;
|
| 100 |
+
border-radius: 10px;
|
| 101 |
+
margin-top: 30px;
|
| 102 |
+
opacity: 0.9;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
form label {
|
| 106 |
+
font-weight: bold;
|
| 107 |
+
color: #34495e;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
.form-group {
|
| 111 |
+
position: relative;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
.form-group i {
|
| 115 |
+
position: absolute;
|
| 116 |
+
left: 10px;
|
| 117 |
+
top: 50%;
|
| 118 |
+
transform: translateY(-50%);
|
| 119 |
+
color: #34495e;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
.form-control {
|
| 123 |
+
padding-left: 30px;
|
| 124 |
+
/* Space for icon */
|
| 125 |
+
border-radius: 10px;
|
| 126 |
+
border: 1px solid #b3c2c8;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
.btn-primary {
|
| 130 |
+
background-color: #22a152;
|
| 131 |
+
border: none;
|
| 132 |
+
border-radius: 20px;
|
| 133 |
+
padding: 10px 20px;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
.btn-primary:hover {
|
| 137 |
+
background-color: #47e684;
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
/* Crop Recommendation Card Styling */
|
| 141 |
+
.recommend-card {
|
| 142 |
+
background-color: #ffffff;
|
| 143 |
+
color: #2c3e50;
|
| 144 |
+
border-radius: 12px;
|
| 145 |
+
overflow: hidden;
|
| 146 |
+
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
|
| 147 |
+
width: 100%;
|
| 148 |
+
max-width: 300px;
|
| 149 |
+
margin: 20px auto;
|
| 150 |
+
text-align: center;
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
.recommend-card img {
|
| 154 |
+
width: 100%;
|
| 155 |
+
height: auto;
|
| 156 |
+
border-bottom: 1px solid #ddd;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
.recommend-card .card-body {
|
| 160 |
+
padding: 15px;
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
.recommend-card .card-title {
|
| 164 |
+
font-size: 1.5rem;
|
| 165 |
+
font-weight: bold;
|
| 166 |
+
color: #0a7a35;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
.recommend-card .crop-name {
|
| 170 |
+
font-size: 1.25rem;
|
| 171 |
+
color: #0a7a35;
|
| 172 |
+
margin-top: 10px;
|
| 173 |
+
font-weight: 600;
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
.recommend-card .card-text {
|
| 177 |
+
font-size: 1rem;
|
| 178 |
+
color: #555;
|
| 179 |
+
margin-top: 10px;
|
| 180 |
+
line-height: 1.5;
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
.card {
|
| 184 |
+
background-color: #ecf0f1;
|
| 185 |
+
border: none;
|
| 186 |
+
border-radius: 10px;
|
| 187 |
+
transition: transform 0.2s, box-shadow 0.2s;
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
.card:hover {
|
| 191 |
+
transform: translateY(-5px);
|
| 192 |
+
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
.card-title {
|
| 196 |
+
color: #2c3e50;
|
| 197 |
+
font-weight: bold;
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
footer {
|
| 201 |
+
background-color: #0a7a35;
|
| 202 |
+
color: #ecf0f1;
|
| 203 |
+
text-align: center;
|
| 204 |
+
padding: 10px 0;
|
| 205 |
+
margin-top: 30px;
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
footer a {
|
| 209 |
+
color: #ecf0f1;
|
| 210 |
+
text-decoration: none;
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
footer a:hover {
|
| 214 |
+
text-decoration: underline;
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
/* Search bar styles */
|
| 218 |
+
.form-control,
|
| 219 |
+
.btn-outline-success {
|
| 220 |
+
border-radius: 25px;
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
.form-control {
|
| 224 |
+
border: 1px solid #fff;
|
| 225 |
+
background-color: rgba(255, 255, 255, 0.7);
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
.btn-outline-success {
|
| 229 |
+
color: #fff;
|
| 230 |
+
border: 1px solid #fff;
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
.btn-outline-success:hover {
|
| 234 |
+
background-color: #47e684;
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
/* Navbar hamburger menu */
|
| 238 |
+
.navbar-toggler-icon {
|
| 239 |
+
background-color: #fff;
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
/* About Section */
|
| 243 |
+
.about-container {
|
| 244 |
+
background-color: rgba(255, 255, 255, 0.9);
|
| 245 |
+
border-radius: 10px;
|
| 246 |
+
padding: 30px;
|
| 247 |
+
margin-top: 30px;
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
.about-section-header {
|
| 251 |
+
color: #2c6f2e;
|
| 252 |
+
/* Green */
|
| 253 |
+
text-align: center;
|
| 254 |
+
margin-bottom: 40px;
|
| 255 |
+
font-weight: bold;
|
| 256 |
+
font-size: 1.8rem;
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
.about-content {
|
| 260 |
+
color: #34495e;
|
| 261 |
+
font-size: 1.1rem;
|
| 262 |
+
line-height: 1.7;
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
.about-content ul {
|
| 266 |
+
list-style-type: none;
|
| 267 |
+
padding-left: 20px;
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
.about-content li {
|
| 271 |
+
margin-bottom: 15px;
|
| 272 |
+
font-size: 1.1rem;
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
.team-member {
|
| 276 |
+
background-color: #f4f4f9;
|
| 277 |
+
padding: 20px;
|
| 278 |
+
margin: 10px 0;
|
| 279 |
+
border-radius: 8px;
|
| 280 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
.team-member h5 {
|
| 284 |
+
color: #2c6f2e;
|
| 285 |
+
font-weight: bold;
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
.team-member p {
|
| 289 |
+
font-size: 1.1rem;
|
| 290 |
+
color: #555;
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
.team-member i {
|
| 294 |
+
color: #0a7a35;
|
| 295 |
+
font-size: 1.3rem;
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
.team-member-icon {
|
| 299 |
+
font-size: 2.5rem;
|
| 300 |
+
margin-bottom: 15px;
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
/* Footer Styling */
|
| 304 |
+
footer {
|
| 305 |
+
background-color: #0a7a35;
|
| 306 |
+
/* Dark green background */
|
| 307 |
+
color: #ecf0f1;
|
| 308 |
+
/* Light text color */
|
| 309 |
+
text-align: center;
|
| 310 |
+
padding: 30px 0;
|
| 311 |
+
margin-top: 40px;
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
footer .container {
|
| 315 |
+
max-width: 1200px;
|
| 316 |
+
margin: 0 auto;
|
| 317 |
+
}
|
| 318 |
+
|
| 319 |
+
footer p {
|
| 320 |
+
margin: 10px 0;
|
| 321 |
+
font-size: 1rem;
|
| 322 |
+
}
|
| 323 |
+
|
| 324 |
+
footer p strong {
|
| 325 |
+
color: #fff;
|
| 326 |
+
/* Make team and institution names stand out */
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
footer ul {
|
| 330 |
+
list-style-type: none;
|
| 331 |
+
padding: 0;
|
| 332 |
+
font-size: 1rem;
|
| 333 |
+
line-height: 1.8;
|
| 334 |
+
margin-top: 10px;
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
+
footer ul li {
|
| 338 |
+
margin-bottom: 8px;
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
footer a {
|
| 342 |
+
color: #ecf0f1;
|
| 343 |
+
text-decoration: none;
|
| 344 |
+
font-weight: bold;
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
footer a:hover {
|
| 348 |
+
text-decoration: underline;
|
| 349 |
+
}
|
| 350 |
+
|
| 351 |
+
/* Add responsiveness for mobile devices */
|
| 352 |
+
@media (max-width: 768px) {
|
| 353 |
+
footer p {
|
| 354 |
+
font-size: 0.9rem;
|
| 355 |
+
}
|
| 356 |
+
|
| 357 |
+
footer ul li {
|
| 358 |
+
font-size: 0.9rem;
|
| 359 |
+
}
|
| 360 |
+
|
| 361 |
+
footer .container {
|
| 362 |
+
padding: 0 15px;
|
| 363 |
+
}
|
| 364 |
+
}
|
| 365 |
+
|
| 366 |
+
/* Make sure the hamburger only appears on mobile or smaller devices */
|
| 367 |
+
@media (max-width: 768px) {
|
| 368 |
+
.navbar-collapse {
|
| 369 |
+
background-color: #0a7a35;
|
| 370 |
+
/* Green background for mobile menu */
|
| 371 |
+
}
|
| 372 |
+
|
| 373 |
+
h1 {
|
| 374 |
+
font-size: 2.5rem;
|
| 375 |
+
margin-top: 10vh;
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
.logo-img {
|
| 379 |
+
width: 15%;
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
}
|
| 383 |
+
|
| 384 |
+
/* About and Contact Sections */
|
| 385 |
+
.section-title {
|
| 386 |
+
color: #2c6f2e;
|
| 387 |
+
/* Green text */
|
| 388 |
+
text-align: center;
|
| 389 |
+
margin-bottom: 30px;
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
.about-container,
|
| 393 |
+
.contact-container {
|
| 394 |
+
background-color: rgba(255, 255, 255, 0.8);
|
| 395 |
+
border-radius: 10px;
|
| 396 |
+
padding: 30px;
|
| 397 |
+
margin-top: 30px;
|
| 398 |
+
}
|
| 399 |
+
|
| 400 |
+
.contact-container form input,
|
| 401 |
+
.contact-container form textarea {
|
| 402 |
+
border-radius: 10px;
|
| 403 |
+
margin-bottom: 20px;
|
| 404 |
+
border: 1px solid #ccc;
|
| 405 |
+
padding: 10px;
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
.contact-container form button {
|
| 409 |
+
background-color: #22a152;
|
| 410 |
+
border: none;
|
| 411 |
+
border-radius: 20px;
|
| 412 |
+
padding: 10px 20px;
|
| 413 |
+
color: #fff;
|
| 414 |
+
}
|
| 415 |
+
|
| 416 |
+
.contact-container form button:hover {
|
| 417 |
+
background-color: #47e684;
|
| 418 |
+
}
|
| 419 |
+
</style>
|
| 420 |
+
</head>
|
| 421 |
+
|
| 422 |
+
<body>
|
| 423 |
+
<!-- Navbar -->
|
| 424 |
+
<nav class="navbar navbar-expand-lg navbar-dark bg-success shadow-sm sticky-top">
|
| 425 |
+
<div class="container-fluid">
|
| 426 |
+
<!-- Brand / Logo -->
|
| 427 |
+
<a class="navbar-brand fw-bold text-white" href="/">
|
| 428 |
+
🌾 Smart Farming
|
| 429 |
+
</a>
|
| 430 |
+
|
| 431 |
+
<!-- Toggler (for mobile view) -->
|
| 432 |
+
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
|
| 433 |
+
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
| 434 |
+
<span class="navbar-toggler-icon"></span>
|
| 435 |
+
</button>
|
| 436 |
+
|
| 437 |
+
<!-- Navbar content -->
|
| 438 |
+
<div class="collapse navbar-collapse" id="navbarNav">
|
| 439 |
+
<!-- Left Nav Links -->
|
| 440 |
+
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
| 441 |
+
<li class="nav-item">
|
| 442 |
+
<a class="nav-link text-white" href="/#">Home</a>
|
| 443 |
+
</li>
|
| 444 |
+
<li class="nav-item">
|
| 445 |
+
<a class="nav-link text-white" href="#about">About</a>
|
| 446 |
+
</li>
|
| 447 |
+
<li class="nav-item">
|
| 448 |
+
<a class="nav-link text-white" href="#cropInfoSection">Crop Info</a>
|
| 449 |
+
</li>
|
| 450 |
+
<li class="nav-item">
|
| 451 |
+
<a class="nav-link text-white" href="#contact">Contact</a>
|
| 452 |
+
</li>
|
| 453 |
+
</ul>
|
| 454 |
+
|
| 455 |
+
<!-- Right: Search bar + Theme toggle -->
|
| 456 |
+
<form class="d-flex me-3" role="search" onsubmit="event.preventDefault(); searchCrops();">
|
| 457 |
+
<input class="form-control me-2" type="search" placeholder="Search crops..." aria-label="Search" id="cropSearchInput">
|
| 458 |
+
<button class="btn btn-light" type="submit">Search</button>
|
| 459 |
+
</form>
|
| 460 |
+
|
| 461 |
+
<!-- Theme toggle button (optional JS needed to function) -->
|
| 462 |
+
<button class="btn btn-outline-light" onclick="toggleTheme()" title="Toggle dark/light mode">
|
| 463 |
+
<i class="fas fa-adjust"></i>
|
| 464 |
+
</button>
|
| 465 |
+
</div>
|
| 466 |
+
</div>
|
| 467 |
+
</nav>
|
| 468 |
+
|
| 469 |
+
<!-- Main Content -->
|
| 470 |
+
<div class="container my-5">
|
| 471 |
+
<h1>Crop Recommendation System<img src="/static/logo.png" alt="Crop Recommendation Logo" class="logo-img"> </h1>
|
| 472 |
+
|
| 473 |
+
<!-- adding form-->
|
| 474 |
+
<form action="/predict" method="POST" class="form-container">
|
| 475 |
+
<div class="row">
|
| 476 |
+
<div class="col-md-4 form-group">
|
| 477 |
+
<label for="Nitrogen">
|
| 478 |
+
<i class="fas fa-leaf"></i> Nitrogen
|
| 479 |
+
</label>
|
| 480 |
+
<div class="input-icon-wrapper">
|
| 481 |
+
<input type="number" id="Nitrogen" name="Nitrogen" placeholder="Enter Nitrogen" class="form-control"
|
| 482 |
+
required step="0">
|
| 483 |
+
</div>
|
| 484 |
+
</div>
|
| 485 |
+
<div class="col-md-4 form-group">
|
| 486 |
+
<label for="Phosporus">
|
| 487 |
+
<i class="fas fa-flask"></i> Phosphorus
|
| 488 |
+
</label>
|
| 489 |
+
<div class="input-icon-wrapper">
|
| 490 |
+
<input type="number" id="Phosporus" name="Phosporus" placeholder="Enter Phosphorus" class="form-control"
|
| 491 |
+
required step="0">
|
| 492 |
+
</div>
|
| 493 |
+
</div>
|
| 494 |
+
<div class="col-md-4 form-group">
|
| 495 |
+
<label for="Potassium">
|
| 496 |
+
<i class="fas fa-atom"></i> Potassium
|
| 497 |
+
</label>
|
| 498 |
+
<div class="input-icon-wrapper">
|
| 499 |
+
<input type="number" id="Potassium" name="Potassium" placeholder="Enter Potassium" class="form-control"
|
| 500 |
+
required step="0">
|
| 501 |
+
</div>
|
| 502 |
+
</div>
|
| 503 |
+
</div>
|
| 504 |
+
|
| 505 |
+
<div class="row mt-4">
|
| 506 |
+
<div class="col-md-4 form-group">
|
| 507 |
+
<label for="Temperature">
|
| 508 |
+
<i class="fas fa-thermometer-half"></i> Temperature (°C)
|
| 509 |
+
</label>
|
| 510 |
+
<div class="input-icon-wrapper">
|
| 511 |
+
<input type="number" id="Temperature" name="Temperature" placeholder="Enter Temperature in °C"
|
| 512 |
+
class="form-control" required step="0.01">
|
| 513 |
+
</div>
|
| 514 |
+
</div>
|
| 515 |
+
<div class="col-md-4 form-group">
|
| 516 |
+
<label for="Humidity">
|
| 517 |
+
<i class="fas fa-tint"></i> Humidity (%)
|
| 518 |
+
</label>
|
| 519 |
+
<div class="input-icon-wrapper">
|
| 520 |
+
<input type="number" id="Humidity" name="Humidity" placeholder="Enter Humidity in %" class="form-control"
|
| 521 |
+
required step="0.01">
|
| 522 |
+
</div>
|
| 523 |
+
</div>
|
| 524 |
+
<div class="col-md-4 form-group">
|
| 525 |
+
<label for="Ph">
|
| 526 |
+
<i class="fas fa-vial"></i> pH
|
| 527 |
+
</label>
|
| 528 |
+
<div class="input-icon-wrapper">
|
| 529 |
+
<input type="number" id="Ph" name="Ph" placeholder="Enter pH value" class="form-control" required
|
| 530 |
+
step="0.01">
|
| 531 |
+
</div>
|
| 532 |
+
</div>
|
| 533 |
+
</div>
|
| 534 |
+
|
| 535 |
+
<div class="row mt-4">
|
| 536 |
+
<div class="col-md-4 form-group">
|
| 537 |
+
<label for="Rainfall">
|
| 538 |
+
<i class="fas fa-cloud-rain"></i> Rainfall (mm)
|
| 539 |
+
</label>
|
| 540 |
+
<div class="input-icon-wrapper">
|
| 541 |
+
<input type="number" id="Rainfall" name="Rainfall" placeholder="Enter Rainfall in mm" class="form-control"
|
| 542 |
+
required>
|
| 543 |
+
</div>
|
| 544 |
+
</div>
|
| 545 |
+
</div>
|
| 546 |
+
|
| 547 |
+
<div class="row mt-4">
|
| 548 |
+
<div class="col-md-12 text-center">
|
| 549 |
+
<button type="submit" class="btn btn-primary btn-lg">
|
| 550 |
+
<i class="fas fa-search"></i> Get Recommendation
|
| 551 |
+
</button>
|
| 552 |
+
</div>
|
| 553 |
+
</div>
|
| 554 |
+
</form>
|
| 555 |
+
|
| 556 |
+
|
| 557 |
+
<!-- Crop Recommendation Display -->
|
| 558 |
+
{% if crop %}
|
| 559 |
+
<div class="recommend-card">
|
| 560 |
+
<img src="{{ url_for('static', filename=crop.image) }}" alt="{{ crop.name }}">
|
| 561 |
+
<div class="card-body">
|
| 562 |
+
<h5 class="card-title">Recommended Crop</h5>
|
| 563 |
+
<h6 class="crop-name">{{ crop.name }}</h6>
|
| 564 |
+
<p class="card-text">{{ crop.description }}</p>
|
| 565 |
+
</div>
|
| 566 |
+
</div>
|
| 567 |
+
{% endif %}
|
| 568 |
+
|
| 569 |
+
</div>
|
| 570 |
+
|
| 571 |
+
|
| 572 |
+
<!-- About Section -->
|
| 573 |
+
<div id="about" class="about-container">
|
| 574 |
+
<h2 class="about-section-header">About the Crop Recommendation System</h2>
|
| 575 |
+
<div class="about-content">
|
| 576 |
+
<p><strong>Overview:</strong></p>
|
| 577 |
+
<p>
|
| 578 |
+
The <strong>Smart Farming: Crop Recommendation System</strong> is an AI-driven agricultural decision-support tool that utilizes a Random Forest Classifier to recommend the most suitable crops for cultivation. By leveraging multi-dimensional environmental parameters including Nitrogen (N), Phosphorus (P), Potassium (K), soil pH, humidity, temperature, and rainfall, the system achieves an impressive <strong>94.3% accuracy</strong> in crop prediction. The model is trained on curated datasets of Indian agricultural conditions and is optimized for practical, real-world application.
|
| 579 |
+
</p>
|
| 580 |
+
|
| 581 |
+
<p>
|
| 582 |
+
Developed as part of an academic research project at <strong>IIIT Lucknow</strong>, this system aims to enhance sustainable farming practices, improve yield optimization, and support data-driven decision-making for Indian farmers.
|
| 583 |
+
</p>
|
| 584 |
+
|
| 585 |
+
<p><strong>Key Features:</strong></p>
|
| 586 |
+
<ul>
|
| 587 |
+
<li><i class="fas fa-seedling"></i> Intelligent crop recommendations based on soil macronutrients and agro-climatic data.</li>
|
| 588 |
+
<li><i class="fas fa-chart-line"></i> Model trained with hyperparameter tuning and k-fold cross-validation for robust performance.</li>
|
| 589 |
+
<li><i class="fas fa-brain"></i> Powered by a supervised learning pipeline using Random Forest Classifier with feature importance analysis.</li>
|
| 590 |
+
<li><i class="fas fa-laptop-code"></i> Deployed via Flask and Hugging Face Spaces with a responsive front-end built in HTML, CSS, and JavaScript.</li>
|
| 591 |
+
</ul>
|
| 592 |
+
|
| 593 |
+
<p><strong>Developer Spotlight:</strong></p>
|
| 594 |
+
<div class="team-member">
|
| 595 |
+
<div class="team-member-icon"><i class="fas fa-user-circle"></i></div>
|
| 596 |
+
<h5>Saksham Pathak</h5>
|
| 597 |
+
<p>
|
| 598 |
+
<strong>Project Lead | AI/ML Engineer | Full-Stack Developer</strong><br>
|
| 599 |
+
Saksham led the end-to-end development of the system — from data preprocessing and feature engineering to training the Random Forest model and designing the UI/UX. He integrated the backend using Flask, deployed the project on Hugging Face Spaces using Docker, and authored the associated academic research paper detailing the methodology, experimentation, and results. His focus was on building a scalable, accurate, and user-centric AI solution tailored to Indian agricultural conditions.
|
| 600 |
+
</p>
|
| 601 |
+
</div>
|
| 602 |
+
</div>
|
| 603 |
+
</div>
|
| 604 |
+
|
| 605 |
+
<!-- Crop Cards Section -->
|
| 606 |
+
<div id="cropInfoSection" class="row">
|
| 607 |
+
<!-- Crop cards will be inserted dynamically here -->
|
| 608 |
+
</div>
|
| 609 |
+
|
| 610 |
+
</div>
|
| 611 |
+
</div>
|
| 612 |
+
|
| 613 |
+
<!-- Contact Section -->
|
| 614 |
+
<div id="contact" class="contact-container">
|
| 615 |
+
<h2 class="section-title">Contact Us</h2>
|
| 616 |
+
<form action="/submit_contact" method="POST">
|
| 617 |
+
<input type="text" name="name" placeholder="Your Name" required class="form-control">
|
| 618 |
+
<input type="email" name="email" placeholder="Your Email" required class="form-control">
|
| 619 |
+
<textarea name="message" placeholder="Your Message" required class="form-control" rows="4"></textarea>
|
| 620 |
+
<button type="submit">Send Message</button>
|
| 621 |
+
</form>
|
| 622 |
+
</div>
|
| 623 |
+
|
| 624 |
+
|
| 625 |
+
<footer
|
| 626 |
+
style="background-color: #0a3c02; color: #eafbe0; padding: 2rem 1rem; font-family: 'Segoe UI', sans-serif; text-align: center;">
|
| 627 |
+
<div class="container" style="max-width: 960px; margin: auto;">
|
| 628 |
+
<p style="font-size: 1.1rem;">© 2024 <strong>CropVista</strong> — Smart Farming for Smarter Yields</p>
|
| 629 |
+
|
| 630 |
+
<p style="font-size: 0.95rem;">
|
| 631 |
+
Cultivated with care by <strong>Saksham Pathak</strong><br>
|
| 632 |
+
M.Sc. Artificial Intelligence & Machine Learning<br>
|
| 633 |
+
<strong>Indian Institute of Information Technology, Lucknow</strong>
|
| 634 |
+
</p>
|
| 635 |
+
|
| 636 |
+
|
| 637 |
+
<div style="margin: 1rem 0; text-align: center;">
|
| 638 |
+
<a href="https://github.com/parthmax2" target="_blank"
|
| 639 |
+
style="color: #b4f7a1; margin: 0 15px; font-size: 1.2rem; text-decoration: none;">
|
| 640 |
+
<i class="fab fa-github"></i> GitHub
|
| 641 |
+
</a>
|
| 642 |
+
<a href="https://www.linkedin.com/in/sakshampathak/" target="_blank"
|
| 643 |
+
style="color: #b4f7a1; margin: 0 15px; font-size: 1.2rem; text-decoration: none;">
|
| 644 |
+
<i class="fab fa-linkedin"></i> LinkedIn
|
| 645 |
+
</a>
|
| 646 |
+
<a href="https://huggingface.co/parthmax" target="_blank"
|
| 647 |
+
style="color: #b4f7a1; margin: 0 15px; font-size: 1.2rem; text-decoration: none;">
|
| 648 |
+
<i class="fas fa-brain"></i> Hugging Face
|
| 649 |
+
</a>
|
| 650 |
+
<a href="mailto:pathaksaksham430@gmail.com"
|
| 651 |
+
style="color: #b4f7a1; margin: 0 15px; font-size: 1.2rem; text-decoration: none;">
|
| 652 |
+
<i class="fas fa-envelope"></i> Email
|
| 653 |
+
</a>
|
| 654 |
+
<a href="https://twitter.com/Parthmax__" target="_blank"
|
| 655 |
+
style="color: #b4f7a1; margin: 0 15px; font-size: 1.2rem; text-decoration: none;">
|
| 656 |
+
<i class="fab fa-twitter"></i> Twitter
|
| 657 |
+
</a>
|
| 658 |
+
</div>
|
| 659 |
+
|
| 660 |
+
|
| 661 |
+
<p>
|
| 662 |
+
<a href="#" style="color: #b4f7a1; text-decoration: none; margin: 0 10px;">Privacy Policy</a>
|
| 663 |
+
</p>
|
| 664 |
+
|
| 665 |
+
<hr style="border-color: #4caf50; margin: 1.5rem 0;" />
|
| 666 |
+
|
| 667 |
+
<p style="font-size: 0.85rem; color: #a6e8a6;">
|
| 668 |
+
🌾 Growing intelligence, one crop at a time — Powered by Flask & Machine Learning
|
| 669 |
+
</p>
|
| 670 |
+
</div>
|
| 671 |
+
</footer>
|
| 672 |
+
|
| 673 |
+
|
| 674 |
+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js"
|
| 675 |
+
integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe"
|
| 676 |
+
crossorigin="anonymous"></script>
|
| 677 |
+
|
| 678 |
+
<script>
|
| 679 |
+
// Crop data (with 22 crops and detailed descriptions)
|
| 680 |
+
const crops = [
|
| 681 |
+
{ name: 'Rice', image: 'rice.jpg', description: 'Rice is a staple crop grown primarily in flooded fields. It thrives in hot, humid climates with regular rainfall and is grown worldwide for its seeds which serve as a primary food source.' },
|
| 682 |
+
{ name: 'Maize', image: 'maize.jpg', description: 'Maize (corn) is a versatile crop grown in temperate climates. It is used for food, livestock feed, and industrial products. It grows best in well-drained soil with moderate rainfall.' },
|
| 683 |
+
{ name: 'Jute', image: 'jute.jpg', description: 'Jute is a fiber crop grown mainly in tropical regions. It is used for making burlap sacks, ropes, and mats. Jute grows best in warm, wet conditions with plenty of sunlight.' },
|
| 684 |
+
{ name: 'Cotton', image: 'cotton.jpg', description: 'Cotton is a key cash crop grown in warm climates. The fibers of the cotton plant are used to make textiles, while the seeds are processed for oil. Cotton requires a long, hot growing season.' },
|
| 685 |
+
{ name: 'Coconut', image: 'coconut.jpg', description: 'Coconut is grown in tropical regions and is a versatile crop providing coconuts, coconut oil, and coir. It grows best in sandy soil with plenty of sunlight and rainfall.' },
|
| 686 |
+
{ name: 'Papaya', image: 'papaya.jpg', description: 'Papaya is a tropical fruit crop that thrives in warm climates. It is rich in vitamins and is grown for both commercial and local consumption. Papaya grows quickly and requires well-drained, fertile soil.' },
|
| 687 |
+
{ name: 'Orange', image: 'orange.jpg', description: 'Oranges are one of the most widely cultivated fruits. They grow best in warm climates with well-drained soil and moderate rainfall. Oranges are rich in vitamin C and are consumed worldwide.' },
|
| 688 |
+
{ name: 'Apple', image: 'apple.jpg', description: 'Apple trees are grown in temperate climates and are known for their crisp fruit. They thrive in areas with cold winters and require well-drained, loamy soil to produce quality fruit.' },
|
| 689 |
+
{ name: 'Muskmelon', image: 'muskmelon.jpg', description: 'Muskmelon is a sweet, fleshy fruit that grows in warm climates. It requires plenty of sunlight, moderate rainfall, and well-drained soil. It is popular for its juicy texture and refreshing taste.' },
|
| 690 |
+
{ name: 'Watermelon', image: 'watermelon.jpg', description: 'Watermelon is a warm-season crop that requires high temperatures and plenty of water. It thrives in sandy soil and is grown for its juicy, sweet fruit consumed during summer.' },
|
| 691 |
+
{ name: 'Grapes', image: 'grapes.jpg', description: 'Grapes are grown for fresh consumption and wine production. They require temperate climates with well-drained soil and moderate rainfall. Grapes need a long growing season to develop their sweet flavor.' },
|
| 692 |
+
{ name: 'Mango', image: 'mango.jpg', description: 'Mango is a tropical fruit tree known for its sweet, juicy fruit. It thrives in hot, humid climates and requires well-drained, sandy loam soil with full sun exposure.' },
|
| 693 |
+
{ name: 'Banana', image: 'banana.jpg', description: 'Bananas are grown in tropical regions and thrive in hot, humid climates. The plant requires regular rainfall and well-drained soil. Bananas are a staple food in many countries.' },
|
| 694 |
+
{ name: 'Pomegranate', image: 'pomegranate.jpg', description: 'Pomegranate is a drought-tolerant fruit crop that grows best in dry, arid climates. The fruit is rich in antioxidants and is cultivated for both fresh consumption and juice production.' },
|
| 695 |
+
{ name: 'Lentil', image: 'lentil.jpg', description: 'Lentil is a legume grown in temperate regions for its protein-rich seeds. It requires well-drained soil and moderate rainfall. Lentils are important for crop rotation as they help fix nitrogen in the soil.' },
|
| 696 |
+
{ name: 'Blackgram', image: 'blackgram.jpg', description: 'Blackgram is a legume crop commonly grown in tropical and subtropical climates. It is an important source of protein and is often used in curries and dals in South Asia.' },
|
| 697 |
+
{ name: 'Mungbean', image: 'mungbean.jpg', description: 'Mungbean is a short-duration crop grown for its small, green seeds. It thrives in warm climates with moderate rainfall and is commonly used in cooking and traditional medicine.' },
|
| 698 |
+
{ name: 'Mothbeans', image: 'mothbeans.jpg', description: 'Mothbeans are drought-resistant legumes grown in arid regions. They are a key source of protein and are grown for their edible seeds which are used in curries and soups.' },
|
| 699 |
+
{ name: 'Pigeonpeas', image: 'pigeonpeas.jpg', description: 'Pigeonpeas are leguminous plants grown in tropical and subtropical regions. They are important for food security in many developing countries due to their high protein content.' },
|
| 700 |
+
{ name: 'Kidneybeans', image: 'kidneybeans.jpg', description: 'Kidney beans are grown for their edible seeds, which are rich in protein. They require a warm growing season and well-drained, fertile soil. Kidney beans are a staple food in many cultures.' },
|
| 701 |
+
{ name: 'Chickpea', image: 'chickpea.jpg', description: 'Chickpea, also known as garbanzo bean, is a pulse crop grown in semi-arid regions. It is a major source of plant-based protein and is grown in rotation to improve soil health.' },
|
| 702 |
+
{ name: 'Coffee', image: 'coffee.jpg', description: 'Coffee is a tropical crop grown primarily in regions with high altitudes. It requires a steady climate with moderate rainfall and is grown for its seeds, which are processed into the popular beverage.' }
|
| 703 |
+
];
|
| 704 |
+
|
| 705 |
+
// Function to render crop information cards
|
| 706 |
+
function renderCrops(filteredCrops) {
|
| 707 |
+
const cropSection = document.getElementById('cropInfoSection');
|
| 708 |
+
cropSection.innerHTML = ''; // Clear existing cards
|
| 709 |
+
filteredCrops.forEach(crop => {
|
| 710 |
+
const cropCard = `
|
| 711 |
+
<div class="col-md-4 mb-3">
|
| 712 |
+
<div class="card">
|
| 713 |
+
<img src="/static/${crop.image}" class="card-img-top" alt="${crop.name}">
|
| 714 |
+
<div class="card-body">
|
| 715 |
+
<h5 class="card-title">${crop.name}</h5>
|
| 716 |
+
<p class="card-text">${crop.description}</p>
|
| 717 |
+
</div>
|
| 718 |
+
</div>
|
| 719 |
+
</div>
|
| 720 |
+
`;
|
| 721 |
+
cropSection.innerHTML += cropCard;
|
| 722 |
+
});
|
| 723 |
+
}
|
| 724 |
+
|
| 725 |
+
// Function to handle crop search
|
| 726 |
+
function searchCrops() {
|
| 727 |
+
const searchQuery = document.getElementById('cropSearchInput').value.toLowerCase();
|
| 728 |
+
const filteredCrops = crops.filter(crop => crop.name.toLowerCase().includes(searchQuery));
|
| 729 |
+
renderCrops(filteredCrops);
|
| 730 |
+
}
|
| 731 |
+
|
| 732 |
+
// Initial render of all crops
|
| 733 |
+
renderCrops(crops);
|
| 734 |
+
</script>
|
| 735 |
+
</body>
|
| 736 |
+
|
| 737 |
+
</html>
|