Spaces:
Runtime error
Runtime error
""" | |
Created on Sun OCT 27 15:24:33 2022 | |
@author: ISAAC EBILOMA | |
""" | |
import pickle | |
import gradio as gr | |
model = pickle.load(open('CatBoost.pkl', 'rb')) | |
def crop(Nitrogen, Phosphorus, | |
Potassium, Temperature, | |
Humidity, pH, Rainfall): | |
prediction = model.predict( | |
[[Nitrogen, Phosphorus, Potassium, Temperature, Humidity, pH, Rainfall]]) | |
return prediction[0] | |
# create input and output objects | |
# input object1 | |
input1 = gr.inputs.Number(label="Nitrogen") | |
# input object 2 | |
input2 = gr.inputs.Number(label="Phosphorus") | |
# input object3 | |
input3 = gr.inputs.Number(label="Potassium") | |
# input object 4 | |
input4 = gr.inputs.Number(label="Temperature") | |
# input object 5 | |
input5 = gr.inputs.Number(label="Humidity") | |
# input object 6 | |
input6 = gr.inputs.Number(label="Soil pH") | |
# input object 7 | |
input7 = gr.inputs.Number(label="Rainfall") | |
# output object | |
output = gr.outputs.Textbox(label="Name of Crop") | |
# create interface | |
gui = gr.Interface(fn=crop, | |
inputs=[input1, input2, input3, | |
input4, input5, input6, input7], | |
outputs=output, title='Crop Yield Prediction System', description='Welcome to our Crop Yield Prediction System, this system can recommend \ | |
kind of crop you should plant based on some properties of the soil and weather conditions.\ | |
This system can predict the following 23 different crops based on the input data supplied by the user to the system.\n \n Isaac Ebiloma').launch() |