Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
#
|
2 |
# !/usr/bin/env python
|
3 |
import numpy as np
|
4 |
import gradio as gr
|
@@ -14,9 +14,7 @@ from roop.utilities import normalize_output_path
|
|
14 |
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 |
|
@@ -65,26 +63,22 @@ def swap_face(source_file, target_file, doFaceEnhancer):
|
|
65 |
start()
|
66 |
return output_path
|
67 |
|
|
|
|
|
|
|
68 |
|
69 |
-
# Define HTML banners
|
70 |
-
banner1 = gr.HTML("<h1>Welcome to the Face Swap App</h1>")
|
71 |
-
banner2 = gr.HTML("<h2>Upload your source and target images below</h2>")
|
72 |
-
banner3 = gr.HTML("<p>Check the box if you want to use the face enhancer feature</p>")
|
73 |
-
|
74 |
-
# Define the interface with HTML banners
|
75 |
app = gr.Interface(
|
76 |
fn=swap_face,
|
77 |
inputs=[
|
78 |
-
|
79 |
-
banner2,
|
80 |
gr.Image(label="Source Image"),
|
81 |
gr.Image(label="Target Image"),
|
82 |
gr.Checkbox(label="Face Enhancer?", info="Do face enhancer?")
|
83 |
],
|
84 |
-
outputs=
|
85 |
-
|
86 |
-
|
87 |
-
|
|
|
88 |
)
|
89 |
-
|
90 |
app.launch()
|
|
|
1 |
+
# -* coding:UTF-8 -*
|
2 |
# !/usr/bin/env python
|
3 |
import numpy as np
|
4 |
import gradio as gr
|
|
|
14 |
import os
|
15 |
from PIL import Image
|
16 |
|
|
|
17 |
def swap_face(source_file, target_file, doFaceEnhancer):
|
|
|
18 |
source_path = "input.jpg"
|
19 |
target_path = "target.jpg"
|
20 |
|
|
|
63 |
start()
|
64 |
return output_path
|
65 |
|
66 |
+
html1 = "<h1>Welcome to Face Swap App</h1>"
|
67 |
+
html2 = "<p>This app allows you to swap faces in images. Upload your source and target images, and optionally enable face enhancement.</p>"
|
68 |
+
html3 = "<footer>Created by Your Name</footer>"
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
app = gr.Interface(
|
71 |
fn=swap_face,
|
72 |
inputs=[
|
73 |
+
gr.HTML(html1),
|
|
|
74 |
gr.Image(label="Source Image"),
|
75 |
gr.Image(label="Target Image"),
|
76 |
gr.Checkbox(label="Face Enhancer?", info="Do face enhancer?")
|
77 |
],
|
78 |
+
outputs=[
|
79 |
+
gr.HTML(html2),
|
80 |
+
"image",
|
81 |
+
gr.HTML(html3)
|
82 |
+
]
|
83 |
)
|
|
|
84 |
app.launch()
|