stardate69 commited on
Commit
a0627ea
·
verified ·
1 Parent(s): d4c09e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -43,20 +43,30 @@ def generate_audio(prompt, negative_prompt, duration, seed):
43
 
44
  # Gradio UI
45
  with gr.Blocks() as demo:
46
- gr.Markdown("## 🎧 Stable Audio Open - Interactive Audio Generation 🎼")
 
 
 
47
  with gr.Row():
48
  prompt_input = gr.Textbox(label="Prompt", value="The sound of a hammer hitting a wooden surface.")
49
  negative_input = gr.Textbox(label="Negative Prompt", value="Low quality.")
50
  with gr.Row():
51
  duration_input = gr.Slider(minimum=1, maximum=10, step=0.5, value=2, label="Duration (seconds)")
52
- seed_input = gr.Number(label="Random Seed", value=0)
 
 
 
 
53
  generate_button = gr.Button("Generate Audio")
54
  output_audio = gr.Audio(label="Generated Audio", type="filepath")
55
 
 
56
  generate_button.click(
57
  generate_audio,
58
- inputs=[prompt_input, negative_input, duration_input, seed_input],
59
  outputs=output_audio
60
  )
61
 
 
62
  demo.launch()
 
 
43
 
44
  # Gradio UI
45
  with gr.Blocks() as demo:
46
+ gr.Markdown("## 🎧 Stable Audio Open - Audio Generation 🎼")
47
+ gr.Markdown("### Adjust prompts, duration, and diffusion steps to control the generation!")
48
+
49
+ # Input Section
50
  with gr.Row():
51
  prompt_input = gr.Textbox(label="Prompt", value="The sound of a hammer hitting a wooden surface.")
52
  negative_input = gr.Textbox(label="Negative Prompt", value="Low quality.")
53
  with gr.Row():
54
  duration_input = gr.Slider(minimum=1, maximum=10, step=0.5, value=2, label="Duration (seconds)")
55
+ diffusion_steps_input = gr.Slider(minimum=10, maximum=500, step=10, value=50, label="Diffusion Steps")
56
+ with gr.Row():
57
+ seed_input = gr.Number(label="Random Seed", value=42)
58
+
59
+ # Output Section
60
  generate_button = gr.Button("Generate Audio")
61
  output_audio = gr.Audio(label="Generated Audio", type="filepath")
62
 
63
+ # Connect the function to the button click
64
  generate_button.click(
65
  generate_audio,
66
+ inputs=[prompt_input, negative_input, duration_input, diffusion_steps_input, seed_input],
67
  outputs=output_audio
68
  )
69
 
70
+ # Launch the app
71
  demo.launch()
72
+