File size: 818 Bytes
26b27eb
d39c517
26b27eb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import pickle
import gradio as gr
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()