Update app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,7 @@ import os
|
|
13 |
from PIL import Image
|
14 |
|
15 |
|
16 |
-
def swap_face(source_file, target_file,
|
17 |
|
18 |
source_path = "input.jpg"
|
19 |
target_path = "target.jpg"
|
@@ -32,8 +32,8 @@ def swap_face(source_file, target_file, doFaceEnhancer):
|
|
32 |
roop.globals.output_path = normalize_output_path(
|
33 |
roop.globals.source_path, roop.globals.target_path, output_path
|
34 |
)
|
35 |
-
if doFaceEnhancer:
|
36 |
-
roop.globals.frame_processors = ["face_swapper",
|
37 |
else:
|
38 |
roop.globals.frame_processors = ["face_swapper"]
|
39 |
roop.globals.headless = True
|
@@ -64,20 +64,7 @@ def swap_face(source_file, target_file, doFaceEnhancer):
|
|
64 |
return output_path
|
65 |
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
with gr.Blocks() as app:
|
72 |
-
gr.HTML(html_section_1)
|
73 |
-
gr.HTML(html_section_2)
|
74 |
-
gr.HTML(html_section_3)
|
75 |
-
source_img = gr.Image()
|
76 |
-
target_img = gr.Image()
|
77 |
-
face_enhancer = gr.Checkbox(label="face_enhancer?", info="do face enhancer?")
|
78 |
-
output_img = gr.Image()
|
79 |
-
|
80 |
-
btn = gr.Button("Submit")
|
81 |
-
btn.click(swap_face, inputs=[source_img, target_img, face_enhancer], outputs=output_img)
|
82 |
-
|
83 |
-
app.launch()
|
|
|
13 |
from PIL import Image
|
14 |
|
15 |
|
16 |
+
def swap_face(source_file, target_file,doFaceEnhancer):
|
17 |
|
18 |
source_path = "input.jpg"
|
19 |
target_path = "target.jpg"
|
|
|
32 |
roop.globals.output_path = normalize_output_path(
|
33 |
roop.globals.source_path, roop.globals.target_path, output_path
|
34 |
)
|
35 |
+
if doFaceEnhancer == True:
|
36 |
+
roop.globals.frame_processors = ["face_swapper","face_enhancer"]
|
37 |
else:
|
38 |
roop.globals.frame_processors = ["face_swapper"]
|
39 |
roop.globals.headless = True
|
|
|
64 |
return output_path
|
65 |
|
66 |
|
67 |
+
app = gr.Interface(
|
68 |
+
fn=swap_face, inputs=[gr.Image(), gr.Image(),gr.Checkbox(label="face_enhancer?", info="do face enhancer?")], outputs="image"
|
69 |
+
)
|
70 |
+
app.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|