Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -7,10 +7,10 @@ import threading
|
|
7 |
# Initialize Refacer
|
8 |
def initialize_refacer():
|
9 |
global refacer
|
10 |
-
print("Initializing Refacer
|
11 |
start_time = time.time()
|
12 |
refacer = Refacer(force_cpu=False, colab_performance=False)
|
13 |
-
print(f"Refacer initialized in {time.time() - start_time:.2f} seconds")
|
14 |
|
15 |
# Ngrok connection
|
16 |
def connect(token, port, options):
|
@@ -63,21 +63,21 @@ dropdown, js = create_theme_dropdown()
|
|
63 |
with gr.Blocks(theme='finlaymacklon/boxy_violet') as demo:
|
64 |
with gr.Row(equal_height=True):
|
65 |
with gr.Column(scale=10):
|
66 |
-
gr.Markdown("# Refacer")
|
67 |
with gr.Row():
|
68 |
-
video = gr.Video(label="Original video", format="mp4")
|
69 |
-
video2 = gr.Video(label="Refaced video", interactive=False, format="mp4")
|
70 |
|
71 |
for i in range(num_faces):
|
72 |
with gr.Tab(f"Face #{i + 1}"):
|
73 |
with gr.Row():
|
74 |
-
origin.append(gr.Image(label="Face to replace"))
|
75 |
-
destination.append(gr.Image(label="Destination face"))
|
76 |
with gr.Row():
|
77 |
thresholds.append(gr.Slider(label="Threshold", minimum=0.0, maximum=1.0, value=0.2))
|
78 |
|
79 |
with gr.Row():
|
80 |
-
button = gr.Button("Reface", variant="primary")
|
81 |
|
82 |
button.click(fn=run, inputs=[video] + origin + destination + thresholds, outputs=[video2])
|
83 |
|
|
|
7 |
# Initialize Refacer
|
8 |
def initialize_refacer():
|
9 |
global refacer
|
10 |
+
print("πͺ’Initializing RefacerβοΈ...")
|
11 |
start_time = time.time()
|
12 |
refacer = Refacer(force_cpu=False, colab_performance=False)
|
13 |
+
print(f"βοΈRefacer initialized in {time.time() - start_time:.2f} seconds")
|
14 |
|
15 |
# Ngrok connection
|
16 |
def connect(token, port, options):
|
|
|
63 |
with gr.Blocks(theme='finlaymacklon/boxy_violet') as demo:
|
64 |
with gr.Row(equal_height=True):
|
65 |
with gr.Column(scale=10):
|
66 |
+
gr.Markdown("# π²π²Refacer")
|
67 |
with gr.Row():
|
68 |
+
video = gr.Video(label="π₯οΈOriginal video", format="πmp4")
|
69 |
+
video2 = gr.Video(label="π»Refaced video", interactive=False, format="πmp4")
|
70 |
|
71 |
for i in range(num_faces):
|
72 |
with gr.Tab(f"Face #{i + 1}"):
|
73 |
with gr.Row():
|
74 |
+
origin.append(gr.Image(label="π οΈFace to replace"))
|
75 |
+
destination.append(gr.Image(label="πDestination face"))
|
76 |
with gr.Row():
|
77 |
thresholds.append(gr.Slider(label="Threshold", minimum=0.0, maximum=1.0, value=0.2))
|
78 |
|
79 |
with gr.Row():
|
80 |
+
button = gr.Button("π«Reface", variant="primary")
|
81 |
|
82 |
button.click(fn=run, inputs=[video] + origin + destination + thresholds, outputs=[video2])
|
83 |
|