Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
d6ae001
1
Parent(s):
5c8506d
Update app.py
Browse files
app.py
CHANGED
@@ -31,11 +31,12 @@ def gradio_generate(prompt, output_format, steps, guidance,duration=10):
|
|
31 |
# output_filename = f"{prompt.replace(' ', '_')}_{steps}_{guidance}"[:250] + ".wav"
|
32 |
output_wave = output_wave.audios[0]
|
33 |
output_filename = "temp.wav"
|
34 |
-
|
|
|
35 |
|
36 |
-
if (output_format == "mp3"):
|
37 |
-
|
38 |
-
|
39 |
|
40 |
return output_filename
|
41 |
|
@@ -49,7 +50,7 @@ Generate audio using Tango2 by providing a text prompt. Tango2 was built from Ta
|
|
49 |
input_text = gr.Textbox(lines=2, label="Prompt")
|
50 |
output_format = gr.Radio(label = "Output format", info = "The file you can dowload", choices = ["mp3", "wav"], value = "wav")
|
51 |
output_audio = gr.Audio(label="Generated Audio", type="filepath")
|
52 |
-
denoising_steps = gr.Slider(minimum=10, maximum=100, value=25, step=
|
53 |
guidance_scale = gr.Slider(minimum=1, maximum=10, value=3, step=0.1, label="Guidance Scale", interactive=True)
|
54 |
duration_scale = gr.Slider(minimum=1, maximum=30, value=10, step=1, label="Duration", interactive=True)
|
55 |
|
|
|
31 |
# output_filename = f"{prompt.replace(' ', '_')}_{steps}_{guidance}"[:250] + ".wav"
|
32 |
output_wave = output_wave.audios[0]
|
33 |
output_filename = "temp.wav"
|
34 |
+
torchaudio.save(output_filename, output_wave, sample_rate=44100)
|
35 |
+
#wavio.write(output_filename, output_wave, rate=44100, sampwidth=2)
|
36 |
|
37 |
+
#if (output_format == "mp3"):
|
38 |
+
# AudioSegment.from_wav("temp.wav").export("temp.mp3", format = "mp3")
|
39 |
+
# output_filename = "temp.mp3"
|
40 |
|
41 |
return output_filename
|
42 |
|
|
|
50 |
input_text = gr.Textbox(lines=2, label="Prompt")
|
51 |
output_format = gr.Radio(label = "Output format", info = "The file you can dowload", choices = ["mp3", "wav"], value = "wav")
|
52 |
output_audio = gr.Audio(label="Generated Audio", type="filepath")
|
53 |
+
denoising_steps = gr.Slider(minimum=10, maximum=100, value=25, step=5, label="Steps", interactive=True)
|
54 |
guidance_scale = gr.Slider(minimum=1, maximum=10, value=3, step=0.1, label="Guidance Scale", interactive=True)
|
55 |
duration_scale = gr.Slider(minimum=1, maximum=30, value=10, step=1, label="Duration", interactive=True)
|
56 |
|