Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,7 +23,7 @@ pipe = StableAudioPipeline.from_pretrained(
|
|
| 23 |
pipe = pipe.to(device)
|
| 24 |
|
| 25 |
# Function to generate audio
|
| 26 |
-
def generate_audio(prompt, negative_prompt
|
| 27 |
generator = torch.Generator(device).manual_seed(seed)
|
| 28 |
audio_output = pipe(
|
| 29 |
prompt=prompt,
|
|
@@ -46,6 +46,7 @@ with gr.Blocks() as demo:
|
|
| 46 |
# Input Section
|
| 47 |
with gr.Row():
|
| 48 |
prompt_input = gr.Textbox(label="Prompt", value="The sound of a hammer hitting a wooden surface.")
|
|
|
|
| 49 |
with gr.Row():
|
| 50 |
duration_input = gr.Slider(minimum=1, maximum=10, step=0.5, value=1, label="Duration (seconds)")
|
| 51 |
diffusion_steps_input = gr.Slider(minimum=1, maximum=500, step=10, value=10, label="Diffusion Steps")
|
|
@@ -59,7 +60,7 @@ with gr.Blocks() as demo:
|
|
| 59 |
# Connect the function to the button click
|
| 60 |
generate_button.click(
|
| 61 |
generate_audio,
|
| 62 |
-
inputs=[prompt_input, duration_input, diffusion_steps_input, seed_input],
|
| 63 |
outputs=output_audio
|
| 64 |
)
|
| 65 |
|
|
|
|
| 23 |
pipe = pipe.to(device)
|
| 24 |
|
| 25 |
# Function to generate audio
|
| 26 |
+
def generate_audio(prompt, negative_prompt, duration, diffusion_steps, seed):
|
| 27 |
generator = torch.Generator(device).manual_seed(seed)
|
| 28 |
audio_output = pipe(
|
| 29 |
prompt=prompt,
|
|
|
|
| 46 |
# Input Section
|
| 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=1, label="Duration (seconds)")
|
| 52 |
diffusion_steps_input = gr.Slider(minimum=1, maximum=500, step=10, value=10, label="Diffusion Steps")
|
|
|
|
| 60 |
# Connect the function to the button click
|
| 61 |
generate_button.click(
|
| 62 |
generate_audio,
|
| 63 |
+
inputs=[prompt_input, negative_input, duration_input, diffusion_steps_input, seed_input],
|
| 64 |
outputs=output_audio
|
| 65 |
)
|
| 66 |
|