Spaces:
Running
Running
victorisgeek
commited on
Commit
β’
c4757ef
1
Parent(s):
68117be
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("
|
11 |
start_time = time.time()
|
12 |
refacer = Refacer(force_cpu=False, colab_performance=False)
|
13 |
-
print(f"
|
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("#
|
67 |
with gr.Row():
|
68 |
-
video = gr.Video(label="
|
69 |
-
video2 = gr.Video(label="
|
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="
|
75 |
-
destination.append(gr.Image(label="
|
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("
|
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 |
|