Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -52,15 +52,10 @@ def incident(pclass, sex, age, sibsp, parch, fare, embarked):
|
|
52 |
input_list.append(fare)
|
53 |
input_list.append(pclass)
|
54 |
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
if res[0] == 1.0:
|
60 |
-
survive_url = "https://raw.githubusercontent.com/Hope-Liang/ID2223Lab1/main/serverless-ml-titanic/images/survived.png"
|
61 |
-
else:
|
62 |
-
survive_url = "https://raw.githubusercontent.com/Hope-Liang/ID2223Lab1/main/serverless-ml-titanic/images/died.png"
|
63 |
-
img = Image.open(requests.get(survive_url, stream=True).raw)
|
64 |
return img
|
65 |
|
66 |
|
|
|
52 |
input_list.append(fare)
|
53 |
input_list.append(pclass)
|
54 |
|
55 |
+
incident = model.predict(np.asarray(input_list).reshape(1, -1))
|
56 |
+
incident_url = "https://raw.githubusercontent.com/Hope-Liang/ID2223Project/main/images/" + incident[0] + ".png"
|
57 |
+
img = Image.open(requests.get(incident_url, stream=True).raw)
|
58 |
+
|
|
|
|
|
|
|
|
|
|
|
59 |
return img
|
60 |
|
61 |
|