CoolFace
Apppublic

abdulsamod/crop_yield

sourceHugging Faceupdated 2y agoView on Hugging Face
1likes
app.py38 linesDownload Raw Back to root
1 2import pickle3import numpy as np4import gradio as gr5import sklearn6 7filename= "model.pkl"8model_ = pickle.load(open(filename, 'rb'))9 10def crop_yield(Planted,Size_of_land, Bags, Soil_Type, Type_of_Seed, Color_of_Seeds):11    prediction = model_.predict([[Planted,Size_of_land, Bags, Soil_Type, Type_of_Seed,Color_of_Seeds]])12    return prediction13 14 15#create input and output objects16#input object117input1 = gr.inputs.Number(label="Planted")18#input object 219input2 = gr.inputs.Number(label="Size of land (Hectare)")20#input object321input3 = gr.inputs.Number(label="Number of Bags")22#input object 323input4 = gr.inputs.Number(label="Soil Type    Input: 0 for Loamy Soil and 1 for others")24#input object 325input5 = gr.inputs.Number(label="Type of Seed   Input: 0 for Super Seed and 1 for others")26#input object 327input6 = gr.inputs.Number(label="Color of Seeds    Input: 0 for White Seed and 1 for others")28 29 30#output object31output = gr.outputs.Textbox(label= "Number of Yields") 32 33#create interface34gui = gr.Interface(fn=crop_yield,35                   inputs=[input1, input2, input3, input4, input5, input6],36                   outputs=output,37                   description="Here's a simple webapp to calculate the number of possible yield.").launch()38