Update app.py
Browse files
app.py
CHANGED
@@ -26,8 +26,12 @@ def titanic(Pclass,Sex,Age,SibSp,Parch,Fare,Embarked):
|
|
26 |
input_list.append(Fare)
|
27 |
input_list.append(Embarked)
|
28 |
# 'res' is a list of predictions returned as the label.
|
29 |
-
res = model.predict(np.asarray(input_list).reshape(1, -1))
|
30 |
-
|
|
|
|
|
|
|
|
|
31 |
|
32 |
demo = gr.Interface(
|
33 |
fn=titanic,
|
@@ -43,8 +47,7 @@ demo = gr.Interface(
|
|
43 |
gr.inputs.Number(default=1.0, label="Fare [USD]"),
|
44 |
gr.inputs.Number(default=1.0, label="Embarked [0 (S), 1 (C), 2 (Q)]"),
|
45 |
],
|
46 |
-
outputs=gr.
|
47 |
-
)
|
48 |
|
49 |
demo.launch()
|
50 |
|
|
|
26 |
input_list.append(Fare)
|
27 |
input_list.append(Embarked)
|
28 |
# 'res' is a list of predictions returned as the label.
|
29 |
+
res = model.predict(np.asarray(input_list).reshape(1, -1))
|
30 |
+
alive_url = "https://illustoon.com/photo/dl/1045.png"
|
31 |
+
died_url = "https://illustoon.com/photo/dl/1052.png"
|
32 |
+
img_path = alive_url if int(res) == 1 else died_url
|
33 |
+
img = Image.open(requests.get(img_path, stream=True).raw)
|
34 |
+
return img
|
35 |
|
36 |
demo = gr.Interface(
|
37 |
fn=titanic,
|
|
|
47 |
gr.inputs.Number(default=1.0, label="Fare [USD]"),
|
48 |
gr.inputs.Number(default=1.0, label="Embarked [0 (S), 1 (C), 2 (Q)]"),
|
49 |
],
|
50 |
+
outputs=gr.Image(type="pil"))
|
|
|
51 |
|
52 |
demo.launch()
|
53 |
|