nock2 commited on
Commit
1c7efde
Β·
verified Β·
1 Parent(s): 2193261

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -6
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 using token from Secrets
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
- # Set device + 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,10 +37,18 @@ def generate_audio(prompt):
37
  torchaudio.save(path, output, sample_rate)
38
  return path
39
 
40
- # Launch UI
41
  gr.Interface(
42
  fn=generate_audio,
43
- inputs=gr.Textbox(label="Enter your sound prompt"),
44
- outputs=gr.Audio(type="filepath"),
45
- title="Stable Audio Generator"
 
 
 
 
 
 
 
 
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()