Spaces:
Runtime error
Runtime error
Commit
·
3cb6014
1
Parent(s):
f1f6be4
app v1
Browse files- app.py +17 -0
- model.pkl +3 -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[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 |
+
demo.launch()
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f7d8e5f110447e7d9d95e12f33e3f5910ff8edff259c3b178a4227505a693fed
|
| 3 |
+
size 13759
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
joblib
|
| 2 |
+
scikit-learn
|