Spaces:
Sleeping
Sleeping
efraim1011
commited on
Commit
•
1c518f1
1
Parent(s):
1a2a4a1
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
|
9 |
+
return {"Did not survive": p[0], "Survived": p[1]}
|
10 |
+
|
11 |
+
demo = gr.Interface(fn=predict,
|
12 |
+
inputs=[gr.Dropdown(choices=["male", "female"], type="index"),
|
13 |
+
"number",
|
14 |
+
gr.Dropdown(choices=["1", "2", "3"], type="value")
|
15 |
+
],
|
16 |
+
outputs="label"
|
17 |
+
)
|
18 |
+
demo.launch()
|