Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -7,13 +7,13 @@ import gradio as gr
|
|
7 |
from stable_audio_tools import get_pretrained_model
|
8 |
from stable_audio_tools.inference.generation import generate_diffusion_cond
|
9 |
|
10 |
-
# Authenticate
|
11 |
token = os.getenv("HUGGINGFACE_TOKEN")
|
12 |
if not token:
|
13 |
raise RuntimeError("HUGGINGFACE_TOKEN not set")
|
14 |
login(token=token, add_to_git_credential=False)
|
15 |
|
16 |
-
#
|
17 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
18 |
model, config = get_pretrained_model("stabilityai/stable-audio-open-small")
|
19 |
model = model.to(device)
|
@@ -37,10 +37,18 @@ def generate_audio(prompt):
|
|
37 |
torchaudio.save(path, output, sample_rate)
|
38 |
return path
|
39 |
|
40 |
-
#
|
41 |
gr.Interface(
|
42 |
fn=generate_audio,
|
43 |
-
inputs=gr.Textbox(label="
|
44 |
-
outputs=gr.Audio(type="filepath"),
|
45 |
-
title="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
).launch()
|
|
|
7 |
from stable_audio_tools import get_pretrained_model
|
8 |
from stable_audio_tools.inference.generation import generate_diffusion_cond
|
9 |
|
10 |
+
# Authenticate
|
11 |
token = os.getenv("HUGGINGFACE_TOKEN")
|
12 |
if not token:
|
13 |
raise RuntimeError("HUGGINGFACE_TOKEN not set")
|
14 |
login(token=token, add_to_git_credential=False)
|
15 |
|
16 |
+
# Load model
|
17 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
18 |
model, config = get_pretrained_model("stabilityai/stable-audio-open-small")
|
19 |
model = model.to(device)
|
|
|
37 |
torchaudio.save(path, output, sample_rate)
|
38 |
return path
|
39 |
|
40 |
+
# π Hot Prompt Club UI
|
41 |
gr.Interface(
|
42 |
fn=generate_audio,
|
43 |
+
inputs=gr.Textbox(label="π€ Prompt your sonic art here", placeholder="e.g. 'drunk driving with mario and yung lean'"),
|
44 |
+
outputs=gr.Audio(type="filepath", label="π§ Generated Audio"),
|
45 |
+
title="π Hot Prompts in Your Area: "My Husband Is Dead",
|
46 |
+
description="Enter a fun sound idea for music art.",
|
47 |
+
examples=[
|
48 |
+
"ghosts peeing in a server room",
|
49 |
+
"ethereal reggaeton at 141 bpm",
|
50 |
+
"startup boss villain entrance music",
|
51 |
+
"AI doing acid jazz fusion in a technofeudalist dystopia",
|
52 |
+
"modular slomecore"
|
53 |
+
]
|
54 |
).launch()
|