Upload 4 files
Browse files- README.md +15 -0
- inference.py +15 -0
- label_encoder.pkl +3 -0
- soil.pkl +3 -0
README.md
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
tags:
|
4 |
+
- crop-recommendation
|
5 |
+
- agriculture
|
6 |
+
- random-forest
|
7 |
+
- classification
|
8 |
+
---
|
9 |
+
|
10 |
+
# Crop Recommendation Model 🌾
|
11 |
+
|
12 |
+
This model recommends the best crop based on soil and weather conditions.
|
13 |
+
Inputs required: Nitrogen, Phosphorus, Potassium, Temperature, Humidity, pH, Rainfall.
|
14 |
+
|
15 |
+
Trained on Crop Recommendation Dataset.
|
inference.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import joblib
|
2 |
+
import numpy as np
|
3 |
+
|
4 |
+
# Load model and label encoder
|
5 |
+
model = joblib.load("soil.pkl")
|
6 |
+
label_encoder = joblib.load("label_encoder.pkl")
|
7 |
+
|
8 |
+
def predict(inputs):
|
9 |
+
"""
|
10 |
+
Inputs: List of 7 features [N, P, K, temperature, humidity, ph, rainfall]
|
11 |
+
"""
|
12 |
+
input_array = np.array(inputs).reshape(1, -1)
|
13 |
+
prediction = model.predict(input_array)
|
14 |
+
crop = label_encoder.inverse_transform(prediction)
|
15 |
+
return crop[0]
|
label_encoder.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2c483356146f16bafb2a06d5a2752f59bcad768e83efae06d6a9982e605b4370
|
3 |
+
size 830
|
soil.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5508cefadfad0197f9e5b029eb072fef25ff804a0c23a6a7a427d10a7d97c9b8
|
3 |
+
size 3672233
|