aheedsajid commited on
Commit
e28be74
·
verified ·
1 Parent(s): 28abf6e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -8
app.py CHANGED
@@ -15,8 +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"
22
 
@@ -34,8 +33,8 @@ 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 == True:
38
- roop.globals.frame_processors = ["face_swapper","face_enhancer"]
39
  else:
40
  roop.globals.frame_processors = ["face_swapper"]
41
  roop.globals.headless = True
@@ -66,7 +65,16 @@ def swap_face(source_file, target_file,doFaceEnhancer):
66
  return output_path
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, doFaceEnhancer):
 
19
  source_path = "input.jpg"
20
  target_path = "target.jpg"
21
 
 
33
  roop.globals.output_path = normalize_output_path(
34
  roop.globals.source_path, roop.globals.target_path, output_path
35
  )
36
+ if doFaceEnhancer:
37
+ roop.globals.frame_processors = ["face_swapper", "face_enhancer"]
38
  else:
39
  roop.globals.frame_processors = ["face_swapper"]
40
  roop.globals.headless = True
 
65
  return output_path
66
 
67
 
68
+ with gr.Blocks() as app:
69
+ gr.HTML("<div style='border: 1px solid black; padding: 10px; margin-bottom: 10px;'>Banner 1</div>")
70
+ gr.HTML("<div style='border: 1px solid black; padding: 10px; margin-bottom: 10px;'>Banner 2</div>")
71
+ gr.HTML("<div style='border: 1px solid black; padding: 10px; margin-bottom: 10px;'>Banner 3</div>")
72
+
73
+ interface = gr.Interface(
74
+ fn=swap_face,
75
+ inputs=[gr.Image(), gr.Image(), gr.Checkbox(label="Face Enhancer?", info="Do face enhancer?")],
76
+ outputs="image"
77
+ )
78
+ interface.launch()
79
+
80
+ app.launch()