Sayiqa commited on
Commit
8e73db1
·
verified ·
1 Parent(s): a6c6155

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pickle
2
+ def make_predicition(sepal_length,sepal_width,petal_length,petal_width):
3
+ with open("model_iris.pkl","rb") as f:
4
+ clf=pickle.load(f)
5
+ preds=clf.predict([[sepal_length,sepal_width,petal_length,petal_width]])
6
+ if preds==0:
7
+ return "IRIS-SETOSA"
8
+ elif preds==1:
9
+ return "IRIS-VERSICOLOR"
10
+ else:
11
+ return "IRIS-VIRGINICA"
12
+ #CREATE the input component for Gradio sinces we are expecting 4 inputs
13
+ sep_len=gr.Number(label="SEPAL LENGTH")
14
+ sep_wid=gr.Number(label="SEPAL WIDTH")
15
+ pet_len=gr.Number(label="PETAL LENGTH")
16
+ pet_wid=gr.Number(label="PETAL WIDTH")
17
+ #create the output
18
+ output=gr.Textbox()
19
+ app=gr.Interface(fn=make_predicition,inputs=[sep_len,sep_wid,pet_len,pet_wid],outputs=output)
20
+ app.launch()