Update app.py
Browse files
app.py
CHANGED
@@ -72,8 +72,8 @@ if torch.cuda.is_available():
|
|
72 |
else:
|
73 |
tango = Tango(device="cpu")
|
74 |
|
75 |
-
def gradio_generate(prompt):
|
76 |
-
output_wave = tango.generate(prompt)
|
77 |
output_filename = "temp_output.wav"
|
78 |
wavio.write(output_filename, output_wave, rate=16000, sampwidth=2)
|
79 |
|
@@ -86,12 +86,13 @@ TANGO is a latent diffusion model (LDM) for text-to-audio (TTA) generation. TANG
|
|
86 |
# Gradio input and output components
|
87 |
input_text = gr.inputs.Textbox(lines=2, label="Prompt")
|
88 |
output_audio = gr.outputs.Audio(label="Generated Audio", type="filepath")
|
89 |
-
|
|
|
90 |
|
91 |
# Gradio interface
|
92 |
gr_interface = gr.Interface(
|
93 |
fn=gradio_generate,
|
94 |
-
inputs=[input_text],
|
95 |
outputs=[output_audio],
|
96 |
title="TANGO: Text to Audio using Instruction-Guided Diffusion",
|
97 |
description="Generate audio using TANGO by providing a text prompt.",
|
|
|
72 |
else:
|
73 |
tango = Tango(device="cpu")
|
74 |
|
75 |
+
def gradio_generate(prompt, steps, guidance):
|
76 |
+
output_wave = tango.generate(prompt, steps, guidance)
|
77 |
output_filename = "temp_output.wav"
|
78 |
wavio.write(output_filename, output_wave, rate=16000, sampwidth=2)
|
79 |
|
|
|
86 |
# Gradio input and output components
|
87 |
input_text = gr.inputs.Textbox(lines=2, label="Prompt")
|
88 |
output_audio = gr.outputs.Audio(label="Generated Audio", type="filepath")
|
89 |
+
denoising_steps = gr.Slider(minimum=100, maximum=200, value=100, step=1, label="Steps", interactive=True)
|
90 |
+
guidance_scale = gr.Slider(minimum=1, maximum=10, value=3, step=0.1, label="Guidance Scale", interactive=True)
|
91 |
|
92 |
# Gradio interface
|
93 |
gr_interface = gr.Interface(
|
94 |
fn=gradio_generate,
|
95 |
+
inputs=[input_text, denoising_steps, guidance_scale],
|
96 |
outputs=[output_audio],
|
97 |
title="TANGO: Text to Audio using Instruction-Guided Diffusion",
|
98 |
description="Generate audio using TANGO by providing a text prompt.",
|