Apex-X commited on
Commit
960dfd4
1 Parent(s): b6f4332

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -15,7 +15,7 @@ import os
15
  from PIL import Image
16
 
17
 
18
- def swap_face(source_file, target_file,doFaceEnhancer):
19
 
20
  source_path = "input.jpg"
21
  target_path = "target.jpg"
@@ -34,10 +34,7 @@ def swap_face(source_file, target_file,doFaceEnhancer):
34
  roop.globals.output_path = normalize_output_path(
35
  roop.globals.source_path, roop.globals.target_path, output_path
36
  )
37
- if doFaceEnhancer == None:
38
- roop.globals.frame_processors = ["face_swapper","face_enhancer"]
39
- else:
40
- roop.globals.frame_processors = ["face_swapper"]
41
  roop.globals.headless = True
42
  roop.globals.keep_fps = True
43
  roop.globals.keep_audio = True
@@ -46,7 +43,7 @@ def swap_face(source_file, target_file,doFaceEnhancer):
46
  roop.globals.video_encoder = "libx264"
47
  roop.globals.video_quality = 18
48
  roop.globals.max_memory = suggest_max_memory()
49
- roop.globals.execution_providers = decode_execution_providers(["cuda"])
50
  roop.globals.execution_threads = suggest_execution_threads()
51
 
52
  print(
@@ -67,6 +64,6 @@ def swap_face(source_file, target_file,doFaceEnhancer):
67
 
68
 
69
  app = gr.Interface(
70
- fn=swap_face, inputs=[gr.Image(), gr.Image(),gr.Checkbox(label="face_enhancer?", info="do face enhancer?")], outputs="image"
71
  )
72
- app.launch()
 
15
  from PIL import Image
16
 
17
 
18
+ def swap_face(source_file, target_file):
19
 
20
  source_path = "input.jpg"
21
  target_path = "target.jpg"
 
34
  roop.globals.output_path = normalize_output_path(
35
  roop.globals.source_path, roop.globals.target_path, output_path
36
  )
37
+ roop.globals.frame_processors = ["face_swapper"]
 
 
 
38
  roop.globals.headless = True
39
  roop.globals.keep_fps = True
40
  roop.globals.keep_audio = True
 
43
  roop.globals.video_encoder = "libx264"
44
  roop.globals.video_quality = 18
45
  roop.globals.max_memory = suggest_max_memory()
46
+ roop.globals.execution_providers = decode_execution_providers(["cpu"])
47
  roop.globals.execution_threads = suggest_execution_threads()
48
 
49
  print(
 
64
 
65
 
66
  app = gr.Interface(
67
+ fn=swap_face, inputs=[gr.Image(), gr.Image()], outputs="image"
68
  )
69
+ app.launch()