Spaces:
Runtime error
Runtime error
app v1
Browse files- app.py +20 -0
- model.pkl +0 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
|
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 = [
|
14 |
+
gr.Dropdown(choices=["male","female"], type="index"),
|
15 |
+
"number",
|
16 |
+
gr.Dropdown(choices=["1","2","3"], type="value")
|
17 |
+
],
|
18 |
+
outputs="label")
|
19 |
+
|
20 |
+
demo.launch()
|
model.pkl
ADDED
Binary file (13.8 kB). View file
|
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
joblib
|
2 |
+
scikit-learn
|
3 |
+
gradio
|