Spaces:
Runtime error
Runtime error
initial commit
Browse files- app.py +23 -0
- crop_predict.pkl +3 -0
- requirements.txt +4 -0
app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import joblib
|
| 3 |
+
|
| 4 |
+
model = joblib.load("crop_predict.pkl")
|
| 5 |
+
|
| 6 |
+
def crop_predict(N, P, K, temperature, humidity, ph, rainfall):
|
| 7 |
+
vals = [float(N), float(P), float(K), float(temperature), float(humidity), float(ph), float(rainfall)]
|
| 8 |
+
out = model.predict([vals])
|
| 9 |
+
return str(out[0])
|
| 10 |
+
|
| 11 |
+
demo = gr.Interface(
|
| 12 |
+
fn=crop_predict,
|
| 13 |
+
inputs=[
|
| 14 |
+
gr.Textbox(label="N"),
|
| 15 |
+
gr.Textbox(label="P"),
|
| 16 |
+
gr.Textbox(label="K"),
|
| 17 |
+
gr.Textbox(label="temperature"),
|
| 18 |
+
gr.Textbox(label="humidity"),
|
| 19 |
+
gr.Textbox(label="ph"),
|
| 20 |
+
gr.Textbox(label="rainfall")
|
| 21 |
+
],
|
| 22 |
+
outputs=gr.Textbox()
|
| 23 |
+
)
|
crop_predict.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:645f2d63bc44623a002f8a8722783229fe7c793c3c019c2e20c941f8b9e4535e
|
| 3 |
+
size 2558
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
joblib
|
| 3 |
+
scikit-learn
|
| 4 |
+
numpy
|