Spaces:
Runtime error
Runtime error
Commit
·
7338df5
1
Parent(s):
2926afe
add examples
Browse files
app.py
CHANGED
@@ -5,19 +5,27 @@ import numpy as np
|
|
5 |
|
6 |
model_helper = help_function()
|
7 |
|
8 |
-
def greet(
|
9 |
-
PIL_image = Image.fromarray(np.uint8(
|
10 |
-
image_edit = model_helper.image_from_text(text,PIL_image,
|
11 |
return image_edit
|
12 |
|
13 |
description = "demo for model to edit face with text, you can see the [github repo CelebrityLook](https://github.com/amit154154/CelebrityLook)"
|
14 |
title = "FaceOver - edit face with text 🐨 "
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
iface = gr.Interface(fn=greet,
|
17 |
inputs=["image", "text", gr.inputs.Slider(0.0, 1.0)],
|
18 |
outputs="image",
|
19 |
title=f"🐦Raven - {title}",
|
20 |
description=description,
|
21 |
-
cache_examples=False
|
|
|
22 |
)
|
23 |
iface.launch()
|
|
|
5 |
|
6 |
model_helper = help_function()
|
7 |
|
8 |
+
def greet(image,text,power):
|
9 |
+
PIL_image = Image.fromarray(np.uint8(image)).convert('RGB')
|
10 |
+
image_edit = model_helper.image_from_text(text,PIL_image,power)
|
11 |
return image_edit
|
12 |
|
13 |
description = "demo for model to edit face with text, you can see the [github repo CelebrityLook](https://github.com/amit154154/CelebrityLook)"
|
14 |
title = "FaceOver - edit face with text 🐨 "
|
15 |
|
16 |
+
examples = [
|
17 |
+
["examples/jennifer lawrence.jpg", "dark hair smiling woman with glasses", 0.58],
|
18 |
+
["examples/kim kardashian.jpg", "beautiful asian woman with short haired ", 0.88],
|
19 |
+
["examples/Arnold Schwarzenegger.jpg", "happy man with long hair and hat", 0.44]
|
20 |
+
|
21 |
+
]
|
22 |
+
|
23 |
iface = gr.Interface(fn=greet,
|
24 |
inputs=["image", "text", gr.inputs.Slider(0.0, 1.0)],
|
25 |
outputs="image",
|
26 |
title=f"🐦Raven - {title}",
|
27 |
description=description,
|
28 |
+
cache_examples=False,
|
29 |
+
examples=examples
|
30 |
)
|
31 |
iface.launch()
|