Update app.py
Browse files
app.py
CHANGED
|
@@ -1,24 +1,24 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import torch
|
| 3 |
-
from diffusers import AudioLDM2Pipeline
|
| 4 |
from share_btn import community_icon_html, loading_icon_html, share_js
|
| 5 |
|
| 6 |
|
| 7 |
# make Space compatible with CPU duplicates
|
| 8 |
-
if torch.cuda.is_available():
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
else:
|
| 12 |
-
|
| 13 |
-
|
| 14 |
|
| 15 |
# load the diffusers pipeline
|
| 16 |
-
repo_id = "cvssp/audioldm2"
|
| 17 |
-
pipe = AudioLDM2Pipeline.from_pretrained(repo_id, torch_dtype=torch_dtype).to(device)
|
| 18 |
-
# pipe.unet = torch.compile(pipe.unet)
|
| 19 |
|
| 20 |
-
# set the generator for reproducibility
|
| 21 |
-
generator = torch.Generator(device)
|
| 22 |
|
| 23 |
|
| 24 |
def text2audio(text, negative_prompt, duration, guidance_scale, random_seed, n_candidates):
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
# import torch
|
| 3 |
+
# from diffusers import AudioLDM2Pipeline
|
| 4 |
from share_btn import community_icon_html, loading_icon_html, share_js
|
| 5 |
|
| 6 |
|
| 7 |
# make Space compatible with CPU duplicates
|
| 8 |
+
# if torch.cuda.is_available():
|
| 9 |
+
# device = "cuda"
|
| 10 |
+
# torch_dtype = torch.float16
|
| 11 |
+
# else:
|
| 12 |
+
# device = "cpu"
|
| 13 |
+
# torch_dtype = torch.float32
|
| 14 |
|
| 15 |
# load the diffusers pipeline
|
| 16 |
+
# repo_id = "cvssp/audioldm2"
|
| 17 |
+
# pipe = AudioLDM2Pipeline.from_pretrained(repo_id, torch_dtype=torch_dtype).to(device)
|
| 18 |
+
# # pipe.unet = torch.compile(pipe.unet)
|
| 19 |
|
| 20 |
+
# # set the generator for reproducibility
|
| 21 |
+
# generator = torch.Generator(device)
|
| 22 |
|
| 23 |
|
| 24 |
def text2audio(text, negative_prompt, duration, guidance_scale, random_seed, n_candidates):
|