Nathanotal commited on
Commit
22e36cf
·
1 Parent(s): 3a0e635
Files changed (1) hide show
  1. app.py +18 -6
app.py CHANGED
@@ -65,7 +65,7 @@ worthlessInputs = ["Name", "Ticket", "Cabin", "Title"]
65
  categoricalInputs = ["Sex", "Embarked", "Pclass"]
66
 
67
  columnHeaders = ["Pclass", "Sex", "Age", "SibSp",
68
- "Parch", "Fare", "Embarked", "Title"] # Todo: remove title
69
 
70
 
71
  def titanic(Pclass, Sex, Age, SibSp, Parch, Fare, Embarked):
@@ -86,23 +86,35 @@ def titanic(Pclass, Sex, Age, SibSp, Parch, Fare, Embarked):
86
 
87
  intLabelToText = {0: "Died", 1: "Survived"}
88
 
89
- age = input_list[0]
90
- gender = input_list[1]
91
  survived = res[0]
92
- survivedText = intLabelToText[survived]
93
 
94
  # Temp:
95
  age = 20
96
  gender = "female"
97
 
98
  # Todo: survivor, "https://fakeface.rest/face/json?maximum_age=50&gender=female&minimum_age=49"
99
- generate_survivor_url = f'https://fakeface.rest/face/json?maximum_age={age}&gender={gender}&minimum_age={age}'
100
  randomized_face_url = requests.get(
101
  generate_survivor_url).json()["image_url"]
102
 
103
  survivor_url = randomized_face_url
104
  img = Image.open(requests.get(survivor_url, stream=True).raw)
105
- return img
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
 
108
  catToInput = {
 
65
  categoricalInputs = ["Sex", "Embarked", "Pclass"]
66
 
67
  columnHeaders = ["Pclass", "Sex", "Age", "SibSp",
68
+ "Parch", "Fare", "Embarked", "Title"] # Todo: remove title
69
 
70
 
71
  def titanic(Pclass, Sex, Age, SibSp, Parch, Fare, Embarked):
 
86
 
87
  intLabelToText = {0: "Died", 1: "Survived"}
88
 
 
 
89
  survived = res[0]
 
90
 
91
  # Temp:
92
  age = 20
93
  gender = "female"
94
 
95
  # Todo: survivor, "https://fakeface.rest/face/json?maximum_age=50&gender=female&minimum_age=49"
96
+ generate_survivor_url = f'https://fakeface.rest/face/json?maximum_age={Age}&gender={Sex}&minimum_age={age}'
97
  randomized_face_url = requests.get(
98
  generate_survivor_url).json()["image_url"]
99
 
100
  survivor_url = randomized_face_url
101
  img = Image.open(requests.get(survivor_url, stream=True).raw)
102
+
103
+ #
104
+ red_cross_url = "https://www.iconsdb.com/icons/preview/red/x-mark-xxl.png"
105
+ green_check_mark_url = "https://www.iconsdb.com/icons/preview/green/checkmark-xxl.png"
106
+
107
+ label_to_url = {
108
+ 0: red_cross_url,
109
+ 1: green_check_mark_url
110
+ }
111
+
112
+ url = label_to_url.get(survived)
113
+
114
+ # Save the image of the person
115
+ img2 = Image.open(requests.get(url, stream=True).raw)
116
+
117
+ return img, img2
118
 
119
 
120
  catToInput = {