File size: 1,247 Bytes
3649fe4
 
 
2724cd3
b8e31af
3649fe4
5f75467
 
3649fe4
50b647c
ac87b69
3649fe4
 
8a2be2a
3649fe4
 
 
 
 
 
 
 
243db99
3649fe4
243db99
3649fe4
243db99
3649fe4
 
 
 
 
 
 
e8178cb
3f054ed
79cdaa6
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

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: 0 for Loamy Soil and 1 for others")
#input object 3
input5 = gr.inputs.Number(label="Type of Seed   Input: 0 for Super Seed and 1 for others")
#input object 3
input6 = gr.inputs.Number(label="Color of Seeds    Input: 0 for White Seed and 1 for others")


#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,
                   description="Here's a simple webapp to calculate the number of possible yield.").launch()