File size: 1,480 Bytes
71e5115
 
 
 
 
 
 
 
 
0d33608
71e5115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""
Created on Sun OCT 27 15:24:33 2022
@author: ISAAC EBILOMA
"""

import pickle
import gradio as gr


model = pickle.load(open('CatBoost.pkl', 'rb'))


def crop(Nitrogen, Phosphorus,
         Potassium, Temperature,
         Humidity, pH, Rainfall):
    prediction = model.predict(
        [[Nitrogen, Phosphorus, Potassium, Temperature, Humidity, pH, Rainfall]])
    return prediction[0]


# create input and output objects
# input object1
input1 = gr.inputs.Number(label="Nitrogen")
# input object 2
input2 = gr.inputs.Number(label="Phosphorus")
# input object3
input3 = gr.inputs.Number(label="Potassium")
# input object 4
input4 = gr.inputs.Number(label="Temperature")
# input object 5
input5 = gr.inputs.Number(label="Humidity")
# input object 6
input6 = gr.inputs.Number(label="Soil pH")
# input object 7
input7 = gr.inputs.Number(label="Rainfall")
# output object
output = gr.outputs.Textbox(label="Name of Crop")


# create interface
gui = gr.Interface(fn=crop,
                   inputs=[input1, input2, input3,
                           input4, input5, input6, input7],
                   outputs=output, title='Crop Yield Prediction System', description='Welcome to our Crop Yield Prediction System, this system can recommend \
kind of crop you should plant based on some properties of the soil and weather conditions.\
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()