khalidey commited on
Commit
e1ecaf4
1 Parent(s): e79895a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -9
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
- # 'res' is a list of predictions returned as the label.
56
- res = model.predict(np.asarray(input_list).reshape(1, -1))
57
- # We add '[0]' to the result of the transformed 'res', because 'res' is a list, and we only want
58
- # the first element.
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