Spaces:
Running
on
Zero
Running
on
Zero
MCP server ready
Browse files- hf_gradio_app.py +18 -1
hf_gradio_app.py
CHANGED
@@ -102,6 +102,23 @@ def process_audio(file_path, temp_dir):
|
|
102 |
@spaces.GPU(duration=240)
|
103 |
@torch.inference_mode()
|
104 |
def generate(input_video, input_audio, seed, progress=gr.Progress(track_tqdm=True)):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
pipeline.reference_net.enable_xformers_memory_efficient_attention()
|
106 |
pipeline.diffusion_net.enable_xformers_memory_efficient_attention()
|
107 |
|
@@ -246,4 +263,4 @@ with gr.Blocks(analytics_enabled=False) as demo:
|
|
246 |
outputs=[video_output],
|
247 |
)
|
248 |
|
249 |
-
demo.queue().launch(share=False, show_api=
|
|
|
102 |
@spaces.GPU(duration=240)
|
103 |
@torch.inference_mode()
|
104 |
def generate(input_video, input_audio, seed, progress=gr.Progress(track_tqdm=True)):
|
105 |
+
"""
|
106 |
+
Generates a talking-head video synchronized with the input audio using the MEMO pipeline.
|
107 |
+
|
108 |
+
This function combines an input face image and an audio clip to create a temporally coherent
|
109 |
+
and emotionally expressive talking video. It leverages a memory-guided diffusion model
|
110 |
+
conditioned on audio features, emotional cues, and visual context.
|
111 |
+
|
112 |
+
Args:
|
113 |
+
input_video (str): Path to the input image file (used as the reference face).
|
114 |
+
input_audio (str): Path to the input audio file (speech or dialogue).
|
115 |
+
seed (int): Random seed for deterministic results. Use 0 for a randomly generated seed.
|
116 |
+
progress (gr.Progress, optional): Gradio progress tracker (automatically passed by Gradio).
|
117 |
+
|
118 |
+
Returns:
|
119 |
+
str: File path to the generated output video (MP4 format).
|
120 |
+
"""
|
121 |
+
|
122 |
pipeline.reference_net.enable_xformers_memory_efficient_attention()
|
123 |
pipeline.diffusion_net.enable_xformers_memory_efficient_attention()
|
124 |
|
|
|
263 |
outputs=[video_output],
|
264 |
)
|
265 |
|
266 |
+
demo.queue().launch(share=False, show_api=True, show_error=True, mcp_server=True)
|