Spaces:
Runtime error
Runtime error
Commit
·
137b57c
1
Parent(s):
3b27c45
fakeface and fix
Browse files
app.py
CHANGED
@@ -29,8 +29,20 @@ def titanic(input_list):
|
|
29 |
|
30 |
# We add '[0]' to the result of the transformed 'res', because 'res' is a list, and we only want
|
31 |
# the first element.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
# Todo: survivor, "https://fakeface.rest/face/json?maximum_age=50&gender=female&minimum_age=49"
|
33 |
-
|
|
|
|
|
|
|
|
|
34 |
img = Image.open(requests.get(survivor_url, stream=True).raw)
|
35 |
return img
|
36 |
|
@@ -44,7 +56,7 @@ demo = gr.Interface(
|
|
44 |
title="Titanic Survivor Predictive Analytics",
|
45 |
description="Experiment with person features to predict which survivor it is.",
|
46 |
allow_flagging="never",
|
47 |
-
inputs=inputs,
|
48 |
outputs=gr.Image(type="pil"))
|
49 |
|
50 |
demo.launch()
|
|
|
29 |
|
30 |
# We add '[0]' to the result of the transformed 'res', because 'res' is a list, and we only want
|
31 |
# the first element.
|
32 |
+
age = input_list[0]
|
33 |
+
gender = input_list[1]
|
34 |
+
survived = res[0]
|
35 |
+
|
36 |
+
# Temp:
|
37 |
+
age = 20
|
38 |
+
gender = "female"
|
39 |
+
|
40 |
# Todo: survivor, "https://fakeface.rest/face/json?maximum_age=50&gender=female&minimum_age=49"
|
41 |
+
generate_survivor_url = f'https://fakeface.rest/face/json?maximum_age={age}&gender={gender}&minimum_age={age}'
|
42 |
+
randomized_face_url = requests.get(
|
43 |
+
generate_survivor_url).json()["image_url"]
|
44 |
+
|
45 |
+
survivor_url = randomized_face_url
|
46 |
img = Image.open(requests.get(survivor_url, stream=True).raw)
|
47 |
return img
|
48 |
|
|
|
56 |
title="Titanic Survivor Predictive Analytics",
|
57 |
description="Experiment with person features to predict which survivor it is.",
|
58 |
allow_flagging="never",
|
59 |
+
inputs=[inputs],
|
60 |
outputs=gr.Image(type="pil"))
|
61 |
|
62 |
demo.launch()
|