Spaces:
Running
Running
Lucas Hansen
commited on
Update simple.py
Browse files
simple.py
CHANGED
|
@@ -12,7 +12,7 @@ def run_cli(cli_args):
|
|
| 12 |
finally:
|
| 13 |
sys.argv = old_argv
|
| 14 |
|
| 15 |
-
def swap_faces(source_image_path, target_image_path,
|
| 16 |
provider = 'cuda'
|
| 17 |
|
| 18 |
target_ext = target_image_path.split('.')[-1]
|
|
@@ -33,12 +33,17 @@ def swap_faces(source_image_path, target_image_path, enhance=True):
|
|
| 33 |
]
|
| 34 |
|
| 35 |
cli_args += [ '--frame-processors', 'face_swapper' ]
|
| 36 |
-
|
|
|
|
| 37 |
cli_args += [
|
| 38 |
-
'frame_enhancer',
|
| 39 |
'face_enhancer',
|
| 40 |
]
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
from facefusion.processors.frame.core import clear_frame_processors_modules
|
| 43 |
clear_frame_processors_modules()
|
| 44 |
|
|
@@ -53,6 +58,7 @@ if __name__ == "__main__":
|
|
| 53 |
gr.Image(type="filepath"),
|
| 54 |
gr.Image(type="filepath"),
|
| 55 |
gr.Checkbox(label="Enhance Face", value=True),
|
|
|
|
| 56 |
],
|
| 57 |
outputs=[
|
| 58 |
gr.Image(
|
|
|
|
| 12 |
finally:
|
| 13 |
sys.argv = old_argv
|
| 14 |
|
| 15 |
+
def swap_faces(source_image_path, target_image_path, enhance_face=True, enhance_frame=True):
|
| 16 |
provider = 'cuda'
|
| 17 |
|
| 18 |
target_ext = target_image_path.split('.')[-1]
|
|
|
|
| 33 |
]
|
| 34 |
|
| 35 |
cli_args += [ '--frame-processors', 'face_swapper' ]
|
| 36 |
+
|
| 37 |
+
if enhance_face:
|
| 38 |
cli_args += [
|
|
|
|
| 39 |
'face_enhancer',
|
| 40 |
]
|
| 41 |
|
| 42 |
+
if enhance_frame:
|
| 43 |
+
cli_args += [
|
| 44 |
+
'frame_enhancer',
|
| 45 |
+
]
|
| 46 |
+
|
| 47 |
from facefusion.processors.frame.core import clear_frame_processors_modules
|
| 48 |
clear_frame_processors_modules()
|
| 49 |
|
|
|
|
| 58 |
gr.Image(type="filepath"),
|
| 59 |
gr.Image(type="filepath"),
|
| 60 |
gr.Checkbox(label="Enhance Face", value=True),
|
| 61 |
+
gr.Checkbox(label="Enhance Frame", value=True),
|
| 62 |
],
|
| 63 |
outputs=[
|
| 64 |
gr.Image(
|