Spaces:
Sleeping
Sleeping
Lucas
commited on
Commit
·
0861518
1
Parent(s):
0e653db
app v1
Browse files- app.py +17 -0
- model.pkl +0 -0
- requirements.txt +2 -0
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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[1], "Survived": p[0]}
|
| 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 |
+
outputs="label")
|
| 16 |
+
|
| 17 |
+
demo.launch()
|
model.pkl
ADDED
|
Binary file (15.3 kB). View file
|
|
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
joblib
|
| 2 |
+
sickit-learn
|