Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -100,11 +100,13 @@ def get_tts_model(model_name: str = "tts_models/en/ljspeech/tacotron2-DDC"):
|
|
100 |
def get_sound_design_pipeline(model_name: str, token: str):
|
101 |
"""
|
102 |
Returns a cached DiffusionPipeline for sound design if available;
|
103 |
-
otherwise, it loads and caches the pipeline.
|
104 |
"""
|
105 |
if model_name in SOUND_DESIGN_PIPELINES:
|
106 |
return SOUND_DESIGN_PIPELINES[model_name]
|
107 |
-
|
|
|
|
|
108 |
SOUND_DESIGN_PIPELINES[model_name] = pipe
|
109 |
return pipe
|
110 |
|
@@ -219,7 +221,7 @@ def generate_music(prompt: str, audio_length: int):
|
|
219 |
@spaces.GPU(duration=200)
|
220 |
def generate_sound_design(prompt: str):
|
221 |
"""
|
222 |
-
Generates a sound design audio file based on the provided prompt using
|
223 |
Returns the file path to the generated .wav file.
|
224 |
"""
|
225 |
try:
|
|
|
100 |
def get_sound_design_pipeline(model_name: str, token: str):
|
101 |
"""
|
102 |
Returns a cached DiffusionPipeline for sound design if available;
|
103 |
+
otherwise, it loads and caches the pipeline using the correct pipeline class.
|
104 |
"""
|
105 |
if model_name in SOUND_DESIGN_PIPELINES:
|
106 |
return SOUND_DESIGN_PIPELINES[model_name]
|
107 |
+
# Import the correct pipeline class from diffusers
|
108 |
+
from diffusers import AudioLDMPipeline
|
109 |
+
pipe = DiffusionPipeline.from_pretrained(model_name, pipeline_class=AudioLDMPipeline, use_auth_token=token)
|
110 |
SOUND_DESIGN_PIPELINES[model_name] = pipe
|
111 |
return pipe
|
112 |
|
|
|
221 |
@spaces.GPU(duration=200)
|
222 |
def generate_sound_design(prompt: str):
|
223 |
"""
|
224 |
+
Generates a sound design audio file based on the provided prompt using Audioldm.
|
225 |
Returns the file path to the generated .wav file.
|
226 |
"""
|
227 |
try:
|