crop_yield / app.py
abdulsamod's picture
Update app.py
b8e31af
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()