Spaces:
Sleeping
Sleeping
import pickle | |
def make_prediction(sepal_length,sepal_width,petal_length,petal_width): | |
with open("model_iris.pkl", "rb") as f: | |
clf = pickle.load(f) | |
preds = clf.predict([[sepal_length,sepal_width,petal_length,petal_width]]) | |
if preds == 0: | |
return "IRIS-SETOSA" | |
elif preds == 1: | |
return "IRIS-VERSICOLOR" | |
else: | |
return "IRIS-VIRGINICA" | |
#Create the input component for Gradio since we are expecting 4 inputs | |
sep_len = gr.Number(label = "SEPAL LENGTH") | |
sep_wid = gr.Number(label = "SEPAL WIDTH") | |
pet_len = gr.Number(label = "PETAL LENGTH") | |
pet_wid = gr.Number(label = "PETAL WIDTH") | |
# We create the output | |
output = gr.Textbox() | |
app = gr.Interface(fn = make_prediction, inputs=[sep_len, sep_wid,pet_len,pet_wid], outputs=output) | |
app.launch() |