Luiz0125 commited on
Commit
3ae2278
1 Parent(s): 9f159be
Files changed (1) hide show
  1. app.py +16 -0
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import joblib as jb
3
+
4
+ def predict(sex, age, pclass):
5
+ model = jb.load('model.pkl')
6
+ pclass = int(pclass)
7
+ p = model.predict_proba([[sex, age, pclass]])[0]
8
+ return {"Did not survive": p[0], "Survived": p[1]}
9
+
10
+ demo = gr.interface(fn=predict,
11
+ inputs=[gr.Dropdown(choices=["male", "female"], type="index"),
12
+ "number",
13
+ gr.Dropdown(choices=["1", "2", "3"], type="value")
14
+ ],
15
+ outputs="label")
16
+ demo.launch()