Spaces:
Runtime error
Runtime error
matias
commited on
Commit
·
465ee60
1
Parent(s):
ee676a1
trying
Browse files
app.py
CHANGED
@@ -2,6 +2,9 @@ from diffusers import AudioLDMPipeline
|
|
2 |
import torch
|
3 |
import gradio as gr
|
4 |
from googletrans import Translator
|
|
|
|
|
|
|
5 |
|
6 |
if torch.cuda.is_available():
|
7 |
device = "cuda"
|
@@ -12,8 +15,8 @@ else:
|
|
12 |
print(device)
|
13 |
repo_id = "cvssp/audioldm-m-full"
|
14 |
pipe = AudioLDMPipeline.from_pretrained(repo_id, torch_dtype=torch_dtype)
|
15 |
-
|
16 |
-
pipe.unet = torch.compile(pipe.unet)
|
17 |
#pipe.unet = torch.compile(pipe.unet)
|
18 |
|
19 |
def generate_sound(text):
|
@@ -23,7 +26,7 @@ def generate_sound(text):
|
|
23 |
text=translator.translate(text, src='es',dest="en").text
|
24 |
print(text)
|
25 |
waveforms = pipe(text,
|
26 |
-
num_inference_steps=
|
27 |
audio_length_in_s=5,
|
28 |
negative_prompt = "low quality, average quality").audios
|
29 |
rate =16000
|
|
|
2 |
import torch
|
3 |
import gradio as gr
|
4 |
from googletrans import Translator
|
5 |
+
import os
|
6 |
+
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
7 |
+
|
8 |
|
9 |
if torch.cuda.is_available():
|
10 |
device = "cuda"
|
|
|
15 |
print(device)
|
16 |
repo_id = "cvssp/audioldm-m-full"
|
17 |
pipe = AudioLDMPipeline.from_pretrained(repo_id, torch_dtype=torch_dtype)
|
18 |
+
pipe = pipe.to(device)
|
19 |
+
# pipe.unet = torch.compile(pipe.unet)
|
20 |
#pipe.unet = torch.compile(pipe.unet)
|
21 |
|
22 |
def generate_sound(text):
|
|
|
26 |
text=translator.translate(text, src='es',dest="en").text
|
27 |
print(text)
|
28 |
waveforms = pipe(text,
|
29 |
+
num_inference_steps=10,
|
30 |
audio_length_in_s=5,
|
31 |
negative_prompt = "low quality, average quality").audios
|
32 |
rate =16000
|