Spaces:
Runtime error
Runtime error
Commit
•
3649fe4
1
Parent(s):
c0a640e
Update app.py
Browse files
app.py
CHANGED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import pickle
|
3 |
+
import numpy as np
|
4 |
+
|
5 |
+
|
6 |
+
model = pickle.load(open(model.pkl, 'rb'))
|
7 |
+
|
8 |
+
def crop_yield(Planted, Size of land (Hectare), Bags, Soil Type, Type of Seed, Color of Seeds):
|
9 |
+
prediction = model.predict([[Planted, Size of land (Hectare), Bags, Soil Type, Type of Seed, Color of Seeds]])
|
10 |
+
return prediction
|
11 |
+
|
12 |
+
#create input and output objects
|
13 |
+
#input object1
|
14 |
+
input1 = gr.inputs.Number(label="Planted")
|
15 |
+
#input object 2
|
16 |
+
input2 = gr.inputs.Number(label="Size of land (Hectare)")
|
17 |
+
#input object3
|
18 |
+
input3 = gr.inputs.Number(label="Number of Bags")
|
19 |
+
#input object 3
|
20 |
+
input4 = gr.inputs.Number(label="Soil Type")
|
21 |
+
#input object 3
|
22 |
+
input5 = gr.inputs.Number(label="Type of Seed")
|
23 |
+
#input object 3
|
24 |
+
input6 = gr.inputs.Number(label="Color of Seeds")
|
25 |
+
|
26 |
+
|
27 |
+
#output object
|
28 |
+
output = gr.outputs.Textbox(label= "Number of Yields")
|
29 |
+
|
30 |
+
#create interface
|
31 |
+
gui = gr.Interface(fn=crop_yield,
|
32 |
+
inputs=[input1, input2, input3, input4],
|
33 |
+
outputs=output).launch()
|