Spaces:
Runtime error
Runtime error
Commit
•
7fec8d1
1
Parent(s):
e913c8c
titanic v1
Browse files
app.py
CHANGED
@@ -1,11 +1,17 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
import joblib as jb
|
3 |
|
4 |
-
def predict(
|
5 |
model = jb.load('model.pkl')
|
6 |
-
|
|
|
|
|
|
|
7 |
|
8 |
demo = gr.Interface(fn=predict,
|
9 |
-
inputs=["
|
10 |
-
|
|
|
|
|
11 |
demo.launch()
|
|
|
1 |
+
from secrets import choice
|
2 |
import gradio as gr
|
3 |
import joblib as jb
|
4 |
|
5 |
+
def predict(sex, age, pclass):
|
6 |
model = jb.load('model.pkl')
|
7 |
+
pclass += 1
|
8 |
+
p = model.predict_proba([[sex, age, pclass]])[0]
|
9 |
+
|
10 |
+
return {"Did not survive": p[0], "Survived": p[1]}
|
11 |
|
12 |
demo = gr.Interface(fn=predict,
|
13 |
+
inputs=[gr.Dropdown(choices=["male", "female"], type="index")
|
14 |
+
, "number",
|
15 |
+
gr.Dropdown(choices=["1", "2", "3"], type="index")],
|
16 |
+
outputs="label")
|
17 |
demo.launch()
|
model.pkl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4aa9451cefc9160e3bbd6b2d9ae47939b67d553d743a521ffb53c19930f945cb
|
3 |
+
size 10591
|