Spaces:
Running
on
Zero
Running
on
Zero
add zeroGPU option
Browse files- hf_gradio_app.py +5 -3
hf_gradio_app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import os, random, time
|
|
|
2 |
import uuid
|
3 |
import tempfile, shutil
|
4 |
from pydub import AudioSegment
|
@@ -78,7 +79,7 @@ def process_audio(file_path, temp_dir):
|
|
78 |
audio = AudioSegment.from_file(file_path)
|
79 |
|
80 |
# Check and cut the audio if longer than 4 seconds
|
81 |
-
max_duration =
|
82 |
if len(audio) > max_duration:
|
83 |
audio = audio[:max_duration]
|
84 |
|
@@ -90,7 +91,8 @@ def process_audio(file_path, temp_dir):
|
|
90 |
print(f"Processed audio saved at: {output_path}")
|
91 |
return output_path
|
92 |
|
93 |
-
|
|
|
94 |
def generate(input_video, input_audio, seed, progress=gr.Progress(track_tqdm=True)):
|
95 |
|
96 |
is_shared_ui = True if "fffiloni/MEMO" in os.environ['SPACE_ID'] else False
|
@@ -194,7 +196,7 @@ def generate(input_video, input_audio, seed, progress=gr.Progress(track_tqdm=Tru
|
|
194 |
with gr.Blocks(analytics_enabled=False) as demo:
|
195 |
with gr.Column():
|
196 |
gr.Markdown("# MEMO: Memory-Guided Diffusion for Expressive Talking Video Generation")
|
197 |
-
gr.Markdown("Note: On fffiloni's shared UI, audio length is trimmed to max
|
198 |
gr.Markdown("Duplicate the space to skip the queue and enjoy full length capacity.")
|
199 |
gr.HTML("""
|
200 |
<div style="display:flex;column-gap:4px;">
|
|
|
1 |
import os, random, time
|
2 |
+
import spaces
|
3 |
import uuid
|
4 |
import tempfile, shutil
|
5 |
from pydub import AudioSegment
|
|
|
79 |
audio = AudioSegment.from_file(file_path)
|
80 |
|
81 |
# Check and cut the audio if longer than 4 seconds
|
82 |
+
max_duration = 4 * 1000 # 4 seconds in milliseconds
|
83 |
if len(audio) > max_duration:
|
84 |
audio = audio[:max_duration]
|
85 |
|
|
|
91 |
print(f"Processed audio saved at: {output_path}")
|
92 |
return output_path
|
93 |
|
94 |
+
#@torch.inference_mode()
|
95 |
+
@spaces.GPU(duration=200)
|
96 |
def generate(input_video, input_audio, seed, progress=gr.Progress(track_tqdm=True)):
|
97 |
|
98 |
is_shared_ui = True if "fffiloni/MEMO" in os.environ['SPACE_ID'] else False
|
|
|
196 |
with gr.Blocks(analytics_enabled=False) as demo:
|
197 |
with gr.Column():
|
198 |
gr.Markdown("# MEMO: Memory-Guided Diffusion for Expressive Talking Video Generation")
|
199 |
+
gr.Markdown("Note: On fffiloni's shared UI, audio length is trimmed to max 4 seconds, so everyone can get a taste without to much waiting time in queue.")
|
200 |
gr.Markdown("Duplicate the space to skip the queue and enjoy full length capacity.")
|
201 |
gr.HTML("""
|
202 |
<div style="display:flex;column-gap:4px;">
|