File size: 1,014 Bytes
3649fe4
 
 
2724cd3
b8e31af
3649fe4
5f75467
 
3649fe4
50b647c
ac87b69
3649fe4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e8178cb
26e7800
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

import pickle
import numpy as np
import gradio as gr
import sklearn

filename= "model.pkl"
model_ = pickle.load(open(filename, 'rb'))

def crop_yield(Planted,Size_of_land, Bags, Soil_Type, Type_of_Seed, Color_of_Seeds):
    prediction = model_.predict([[Planted,Size_of_land, Bags, Soil_Type, Type_of_Seed,Color_of_Seeds]])
    return prediction

#create input and output objects
#input object1
input1 = gr.inputs.Number(label="Planted")
#input object 2
input2 = gr.inputs.Number(label="Size of land (Hectare)")
#input object3
input3 = gr.inputs.Number(label="Number of Bags")
#input object 3
input4 = gr.inputs.Number(label="Soil Type")
#input object 3
input5 = gr.inputs.Number(label="Type of Seed")
#input object 3
input6 = gr.inputs.Number(label="Color of Seeds")


#output object
output = gr.outputs.Textbox(label= "Number of Yields") 

#create interface
gui = gr.Interface(fn=crop_yield,
                   inputs=[input1, input2, input3, input4, input5, input6],
                   outputs=output).launch()