Spaces:
Running
Running
victorisgeek
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -220,7 +220,7 @@ def process(
|
|
220 |
## ------------------------------ CONTENT CHECK ------------------------------
|
221 |
|
222 |
|
223 |
-
yield "### \n 📡
|
224 |
if condition != "Specific Face":
|
225 |
source_data = source_path, age
|
226 |
else:
|
@@ -236,7 +236,7 @@ def process(
|
|
236 |
|
237 |
## ------------------------------ SWAP FUNC ------------------------------
|
238 |
|
239 |
-
yield "### \n ⚙️
|
240 |
preds = []
|
241 |
matrs = []
|
242 |
count = 0
|
@@ -525,14 +525,14 @@ def slider_changed(show_frame, video_path, frame_index):
|
|
525 |
|
526 |
|
527 |
def trim_and_reload(video_path, output_path, output_name, start_frame, stop_frame):
|
528 |
-
yield video_path, f"### \n 🛠️
|
529 |
try:
|
530 |
output_path = os.path.join(output_path, output_name)
|
531 |
trimmed_video = trim_video(video_path, output_path, start_frame, stop_frame)
|
532 |
-
yield trimmed_video, "### \n
|
533 |
except Exception as e:
|
534 |
print(e)
|
535 |
-
yield video_path, "### \n ❌
|
536 |
|
537 |
|
538 |
## ------------------------------ GRADIO GUI ------------------------------
|
@@ -543,7 +543,7 @@ footer{display:none !important}
|
|
543 |
|
544 |
with gr.Blocks(theme='earneleh/paris') as interface:
|
545 |
gr.Markdown("# 🧸 Deepfake Faceswap")
|
546 |
-
gr.Markdown("###
|
547 |
with gr.Row():
|
548 |
with gr.Row():
|
549 |
with gr.Column(scale=0.4):
|
@@ -560,7 +560,7 @@ with gr.Blocks(theme='earneleh/paris') as interface:
|
|
560 |
value=25, label="Value", interactive=True, visible=False
|
561 |
)
|
562 |
|
563 |
-
with gr.Tab("
|
564 |
detect_condition_dropdown = gr.Dropdown(
|
565 |
detect_conditions,
|
566 |
label="Condition",
|
@@ -578,7 +578,7 @@ with gr.Blocks(theme='earneleh/paris') as interface:
|
|
578 |
)
|
579 |
apply_detection_settings = gr.Button("Apply settings")
|
580 |
|
581 |
-
with gr.Tab("♻️
|
582 |
output_directory = gr.Text(
|
583 |
label="Output Directory",
|
584 |
value=DEF_OUTPUT_PATH,
|
@@ -591,7 +591,7 @@ with gr.Blocks(theme='earneleh/paris') as interface:
|
|
591 |
label="Keep output sequence", value=False, interactive=True
|
592 |
)
|
593 |
|
594 |
-
with gr.Tab("💎
|
595 |
face_scale = gr.Slider(
|
596 |
label="Face Scale",
|
597 |
minimum=0,
|
@@ -706,7 +706,7 @@ with gr.Blocks(theme='earneleh/paris') as interface:
|
|
706 |
video_input = gr.Video(
|
707 |
label="Target Video", interactive=True
|
708 |
)
|
709 |
-
with gr.Accordion("
|
710 |
with gr.Column():
|
711 |
with gr.Row():
|
712 |
set_slider_range_btn = gr.Button(
|
|
|
220 |
## ------------------------------ CONTENT CHECK ------------------------------
|
221 |
|
222 |
|
223 |
+
yield "### \n 📡Analysing face data...", *ui_before()
|
224 |
if condition != "Specific Face":
|
225 |
source_data = source_path, age
|
226 |
else:
|
|
|
236 |
|
237 |
## ------------------------------ SWAP FUNC ------------------------------
|
238 |
|
239 |
+
yield "### \n ⚙️Generating faces...", *ui_before()
|
240 |
preds = []
|
241 |
matrs = []
|
242 |
count = 0
|
|
|
525 |
|
526 |
|
527 |
def trim_and_reload(video_path, output_path, output_name, start_frame, stop_frame):
|
528 |
+
yield video_path, f"### \n 🛠️Trimming video frame {start_frame} to {stop_frame}..."
|
529 |
try:
|
530 |
output_path = os.path.join(output_path, output_name)
|
531 |
trimmed_video = trim_video(video_path, output_path, start_frame, stop_frame)
|
532 |
+
yield trimmed_video, "### \n 🍄Video trimmed and reloaded."
|
533 |
except Exception as e:
|
534 |
print(e)
|
535 |
+
yield video_path, "### \n ❌Video trimming failed. See console for more info."
|
536 |
|
537 |
|
538 |
## ------------------------------ GRADIO GUI ------------------------------
|
|
|
543 |
|
544 |
with gr.Blocks(theme='earneleh/paris') as interface:
|
545 |
gr.Markdown("# 🧸 Deepfake Faceswap")
|
546 |
+
gr.Markdown("### •insightface inswapper bypass NSFW.")
|
547 |
with gr.Row():
|
548 |
with gr.Row():
|
549 |
with gr.Column(scale=0.4):
|
|
|
560 |
value=25, label="Value", interactive=True, visible=False
|
561 |
)
|
562 |
|
563 |
+
with gr.Tab("💉Detection Settings"):
|
564 |
detect_condition_dropdown = gr.Dropdown(
|
565 |
detect_conditions,
|
566 |
label="Condition",
|
|
|
578 |
)
|
579 |
apply_detection_settings = gr.Button("Apply settings")
|
580 |
|
581 |
+
with gr.Tab("♻️Output Settings"):
|
582 |
output_directory = gr.Text(
|
583 |
label="Output Directory",
|
584 |
value=DEF_OUTPUT_PATH,
|
|
|
591 |
label="Keep output sequence", value=False, interactive=True
|
592 |
)
|
593 |
|
594 |
+
with gr.Tab("💎Other Settings"):
|
595 |
face_scale = gr.Slider(
|
596 |
label="Face Scale",
|
597 |
minimum=0,
|
|
|
706 |
video_input = gr.Video(
|
707 |
label="Target Video", interactive=True
|
708 |
)
|
709 |
+
with gr.Accordion("🔧Trim video", open=False):
|
710 |
with gr.Column():
|
711 |
with gr.Row():
|
712 |
set_slider_range_btn = gr.Button(
|