aheedsajid commited on
Commit
465c5d2
·
verified ·
1 Parent(s): 57c6123

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -15
app.py CHANGED
@@ -1,5 +1,3 @@
1
- # -* coding:UTF-8 -*
2
- # !/usr/bin/env python
3
  import numpy as np
4
  import gradio as gr
5
  import roop.globals
@@ -14,10 +12,6 @@ from roop.utilities import normalize_output_path
14
  import os
15
  from PIL import Image
16
 
17
- # Define HTML content for banners and additional sections
18
- html_banner = "<h2>Welcome to Face Swapper App</h2>"
19
- html_section1 = "<h3>Instructions:</h3><p>Upload source and target images, and select 'Face Enhancer' option if desired.</p>"
20
- html_section2 = "<h3>Additional Info:</h3><p>This app uses CUDA for faster processing.</p>"
21
 
22
  def swap_face(source_file, target_file, doFaceEnhancer):
23
 
@@ -69,14 +63,21 @@ def swap_face(source_file, target_file, doFaceEnhancer):
69
  start()
70
  return output_path
71
 
72
- # Define Gradio interface with HTML banners and sections
73
- app = gr.Interface(
74
- fn=swap_face,
75
- inputs=[gr.Image(), gr.Image(), gr.Checkbox(label="Enable Face Enhancer", default=False)],
76
- outputs="image",
77
- title="Face Swapper",
78
- description="Swap faces between two images with optional face enhancement.",
79
- html=[html_banner, html_section1, html_section2]
80
- )
 
 
 
 
 
 
 
81
 
82
  app.launch()
 
 
 
1
  import numpy as np
2
  import gradio as gr
3
  import roop.globals
 
12
  import os
13
  from PIL import Image
14
 
 
 
 
 
15
 
16
  def swap_face(source_file, target_file, doFaceEnhancer):
17
 
 
63
  start()
64
  return output_path
65
 
66
+
67
+ html_section_1 = "<div><h1>Welcome to the Face Swap App</h1></div>"
68
+ html_section_2 = "<div><p>Upload your source and target images to swap faces. Optionally, use the face enhancer feature.</p></div>"
69
+ html_section_3 = "<div><p>After processing, the swapped image will be displayed below.</p></div>"
70
+
71
+ app = gr.Blocks()
72
+
73
+ with app:
74
+ gr.HTML(html_section_1)
75
+ gr.HTML(html_section_2)
76
+ gr.HTML(html_section_3)
77
+ gr.Interface(
78
+ fn=swap_face,
79
+ inputs=[gr.Image(), gr.Image(), gr.Checkbox(label="face_enhancer?", info="do face enhancer?")],
80
+ outputs="image"
81
+ )
82
 
83
  app.launch()