Spaces:
Runtime error
Runtime error
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() |