Spaces:
Running
on
Zero
Running
on
Zero
MCP ready
Browse files
app.py
CHANGED
|
@@ -400,6 +400,32 @@ def random_seed():
|
|
| 400 |
|
| 401 |
@spaces.GPU(duration=180)
|
| 402 |
def infer(lq_sequence, task_name, mask, seed, progress=gr.Progress(track_tqdm=True)):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 403 |
|
| 404 |
if is_shared_ui:
|
| 405 |
lq_sequence, temp_input_folder = process_video(lq_sequence)
|
|
@@ -527,4 +553,4 @@ with gr.Blocks(css=css) as demo:
|
|
| 527 |
outputs=[input_seq, task_name, mask_input, seed_input, output_face, output_res]
|
| 528 |
)
|
| 529 |
|
| 530 |
-
demo.queue().launch(show_api=False, show_error=True, ssr_mode=False)
|
|
|
|
| 400 |
|
| 401 |
@spaces.GPU(duration=180)
|
| 402 |
def infer(lq_sequence, task_name, mask, seed, progress=gr.Progress(track_tqdm=True)):
|
| 403 |
+
"""
|
| 404 |
+
Perform face video restoration on an input video using selected tasks.
|
| 405 |
+
|
| 406 |
+
This function supports multiple restoration tasks on low-quality video input,
|
| 407 |
+
including Blind Face Restoration (BFR), Colorization, and Inpainting.
|
| 408 |
+
|
| 409 |
+
Depending on user selection, it processes the video and applies the selected
|
| 410 |
+
restoration models. It then returns two video outputs:
|
| 411 |
+
- The face region extracted from the input
|
| 412 |
+
- The fully restored output video
|
| 413 |
+
|
| 414 |
+
Args:
|
| 415 |
+
lq_sequence: The input low-quality video file (can be a path or Gradio video object).
|
| 416 |
+
task_name: A list of selected restoration tasks to perform. Choices include:
|
| 417 |
+
- "BFR" for Blind Face Restoration
|
| 418 |
+
- "Colorization" for adding color to grayscale footage
|
| 419 |
+
- "Inpainting" for filling in missing or corrupted regions using a mask
|
| 420 |
+
mask: An optional image file that defines regions to be inpainted (only needed if "Inpainting" is selected).
|
| 421 |
+
seed: An integer seed for random number generation to ensure reproducibility.
|
| 422 |
+
progress: (Optional) A Gradio progress object for UI progress tracking (used automatically).
|
| 423 |
+
|
| 424 |
+
Returns:
|
| 425 |
+
A tuple of:
|
| 426 |
+
- face_region_video_path: Path to the video showing extracted face region
|
| 427 |
+
- output_video_path: Path to the restored output video
|
| 428 |
+
"""
|
| 429 |
|
| 430 |
if is_shared_ui:
|
| 431 |
lq_sequence, temp_input_folder = process_video(lq_sequence)
|
|
|
|
| 553 |
outputs=[input_seq, task_name, mask_input, seed_input, output_face, output_res]
|
| 554 |
)
|
| 555 |
|
| 556 |
+
demo.queue().launch(show_api=False, show_error=True, ssr_mode=False, mcp_server=True)
|