Isaacebiloma commited on
Commit
71e5115
1 Parent(s): 4efa650

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -0
app.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Created on Sun OCT 27 15:24:33 2022
3
+ @author: ISAAC EBILOMA
4
+ """
5
+
6
+ import pickle
7
+ import gradio as gr
8
+
9
+
10
+ model = pickle.load(open('RandomForest.pkl', 'rb'))
11
+
12
+
13
+ def crop(Nitrogen, Phosphorus,
14
+ Potassium, Temperature,
15
+ Humidity, pH, Rainfall):
16
+ prediction = model.predict(
17
+ [[Nitrogen, Phosphorus, Potassium, Temperature, Humidity, pH, Rainfall]])
18
+ return prediction[0]
19
+
20
+
21
+ # create input and output objects
22
+ # input object1
23
+ input1 = gr.inputs.Number(label="Nitrogen")
24
+ # input object 2
25
+ input2 = gr.inputs.Number(label="Phosphorus")
26
+ # input object3
27
+ input3 = gr.inputs.Number(label="Potassium")
28
+ # input object 4
29
+ input4 = gr.inputs.Number(label="Temperature")
30
+ # input object 5
31
+ input5 = gr.inputs.Number(label="Humidity")
32
+ # input object 6
33
+ input6 = gr.inputs.Number(label="Soil pH")
34
+ # input object 7
35
+ input7 = gr.inputs.Number(label="Rainfall")
36
+ # output object
37
+ output = gr.outputs.Textbox(label="Name of Crop")
38
+
39
+
40
+ # create interface
41
+ gui = gr.Interface(fn=crop,
42
+ inputs=[input1, input2, input3,
43
+ input4, input5, input6, input7],
44
+ outputs=output, title='Crop Yield Prediction System', description='Welcome to our Crop Yield Prediction System, this system can recommend \
45
+ kind of crop you should plant based on some properties of the soil and weather conditions.\
46
+ This system can predict the following 23 different crops based on the input data supplied by the user to the system.\n \n Isaac Ebiloma').launch()