Spaces:
Runtime error
Runtime error
New interface
Browse files
app.py
CHANGED
|
@@ -84,17 +84,19 @@ def gradio_generate(prompt, steps, guidance):
|
|
| 84 |
output_wave = tango.generate(prompt, steps, guidance)
|
| 85 |
return gr.make_waveform((16000, output_wave))
|
| 86 |
|
| 87 |
-
|
|
|
|
|
|
|
| 88 |
<p style="text-align: center;">
|
| 89 |
<b><big><big><big>Text-to-Audio</big></big></big></b>
|
| 90 |
<br/>Generates an audio file, freely, without account, without watermark, that you can download.
|
| 91 |
</p>
|
| 92 |
<br/>
|
| 93 |
<br/>
|
| 94 |
-
|
| 95 |
<br/>
|
| 96 |
<ul>
|
| 97 |
-
<li>If you need to generate <b>music</b>, I recommend
|
| 98 |
</ul>
|
| 99 |
<br/>
|
| 100 |
π Slow process... Your computer must <b><u>not</u></b> enter into standby mode.<br/>You can duplicate this space on a free account, it works on CPU.<br/>
|
|
@@ -102,48 +104,41 @@ description_text = """
|
|
| 102 |
<br/>
|
| 103 |
βοΈ You can use, modify and share the generated sounds but not for commercial uses.
|
| 104 |
"""
|
| 105 |
-
|
| 106 |
-
input_text = gr.Textbox(label = "Prompt", value = "Snort of a horse", lines = 2, autofocus = True)
|
| 107 |
-
denoising_steps = gr.Slider(label = "Steps", minimum = 100, maximum = 200, value = 100, step = 1, interactive = True)
|
| 108 |
-
guidance_scale = gr.Slider(label = "Guidance Scale", minimum = 1, maximum = 10, value = 3, step = 0.1, interactive = True)
|
| 109 |
|
| 110 |
-
|
| 111 |
|
| 112 |
-
|
| 113 |
-
gr_interface = gr.Interface(
|
| 114 |
-
fn = gradio_generate,
|
| 115 |
-
inputs = [input_text, denoising_steps, guidance_scale],
|
| 116 |
-
outputs = [output_audio],
|
| 117 |
-
title = "",
|
| 118 |
-
description = description_text,
|
| 119 |
-
allow_flagging = False,
|
| 120 |
-
examples = [
|
| 121 |
-
["Quiet speech and then and airplane flying away"],
|
| 122 |
-
["A bicycle peddling on dirt and gravel followed by a man speaking then laughing"],
|
| 123 |
-
["Ducks quack and water splashes with some animal screeching in the background"],
|
| 124 |
-
["Describe the sound of the ocean"],
|
| 125 |
-
["A woman and a baby are having a conversation"],
|
| 126 |
-
["A man speaks followed by a popping noise and laughter"],
|
| 127 |
-
["A cup is filled from a faucet"],
|
| 128 |
-
["An audience cheering and clapping"],
|
| 129 |
-
["Rolling thunder with lightning strikes"],
|
| 130 |
-
["A dog barking and a cat mewing and a racing car passes by"],
|
| 131 |
-
["Gentle water stream, birds chirping and sudden gun shot"],
|
| 132 |
-
["A man talking followed by a goat baaing then a metal gate sliding shut as ducks quack and wind blows into a microphone."],
|
| 133 |
-
["A dog barking"],
|
| 134 |
-
["A cat meowing"],
|
| 135 |
-
["Wooden table tapping sound while water pouring"],
|
| 136 |
-
["Applause from a crowd with distant clicking and a man speaking over a loudspeaker"],
|
| 137 |
-
["two gunshots followed by birds flying away while chirping"],
|
| 138 |
-
["Whistling with birds chirping"],
|
| 139 |
-
["A person snoring"],
|
| 140 |
-
["Motor vehicles are driving with loud engines and a person whistles"],
|
| 141 |
-
["People cheering in a stadium while thunder and lightning strikes"],
|
| 142 |
-
["A helicopter is in flight"],
|
| 143 |
-
["A dog barking and a man talking and a racing car passes by"],
|
| 144 |
-
],
|
| 145 |
-
cache_examples = "lazy", # Turn on to cache.
|
| 146 |
-
)
|
| 147 |
|
| 148 |
-
|
| 149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
output_wave = tango.generate(prompt, steps, guidance)
|
| 85 |
return gr.make_waveform((16000, output_wave))
|
| 86 |
|
| 87 |
+
# Gradio interface
|
| 88 |
+
with gr.Blocks() as interface:
|
| 89 |
+
gr.Markdown("""
|
| 90 |
<p style="text-align: center;">
|
| 91 |
<b><big><big><big>Text-to-Audio</big></big></big></b>
|
| 92 |
<br/>Generates an audio file, freely, without account, without watermark, that you can download.
|
| 93 |
</p>
|
| 94 |
<br/>
|
| 95 |
<br/>
|
| 96 |
+
β¨ Powered by <i>Tango 2</i> AI.
|
| 97 |
<br/>
|
| 98 |
<ul>
|
| 99 |
+
<li>If you need to generate <b>music</b>, I recommend to use <i>MusicGen</i>,</li>
|
| 100 |
</ul>
|
| 101 |
<br/>
|
| 102 |
π Slow process... Your computer must <b><u>not</u></b> enter into standby mode.<br/>You can duplicate this space on a free account, it works on CPU.<br/>
|
|
|
|
| 104 |
<br/>
|
| 105 |
βοΈ You can use, modify and share the generated sounds but not for commercial uses.
|
| 106 |
"""
|
| 107 |
+
)
|
| 108 |
+
input_text = gr.Textbox(label = "Prompt", value = "Snort of a horse", lines = 2, autofocus = True)
|
| 109 |
+
denoising_steps = gr.Slider(label = "Steps", minimum = 100, maximum = 200, value = 100, step = 1, interactive = True)
|
| 110 |
+
guidance_scale = gr.Slider(label = "Guidance Scale", minimum = 1, maximum = 10, value = 3, step = 0.1, interactive = True)
|
| 111 |
|
| 112 |
+
submit = gr.Button("Generate π", variant = "primary")
|
| 113 |
|
| 114 |
+
output_audio = gr.Audio(label = "Generated Audio")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
|
| 116 |
+
submit.click(fn = gradio_generate, inputs = [
|
| 117 |
+
input_text,
|
| 118 |
+
denoising_steps,
|
| 119 |
+
guidance_scale
|
| 120 |
+
], outputs = [
|
| 121 |
+
output_audio
|
| 122 |
+
], scroll_to_output = True)
|
| 123 |
+
|
| 124 |
+
gr.Examples(
|
| 125 |
+
fn = gradio_generate,
|
| 126 |
+
inputs = [
|
| 127 |
+
input_text,
|
| 128 |
+
denoising_steps,
|
| 129 |
+
guidance_scale
|
| 130 |
+
],
|
| 131 |
+
outputs = [
|
| 132 |
+
output_audio
|
| 133 |
+
],
|
| 134 |
+
examples = [
|
| 135 |
+
["A hammer is hitting a wooden surface", 100, 3],
|
| 136 |
+
["Peaceful and calming ambient music with singing bowl and other instruments.", 100, 3],
|
| 137 |
+
["A man is speaking in a small room.", 100, 3],
|
| 138 |
+
["A female is speaking followed by footstep sound", 100, 3],
|
| 139 |
+
["Wooden table tapping sound followed by water pouring sound.", 100, 3],
|
| 140 |
+
],
|
| 141 |
+
cache_examples = False,
|
| 142 |
+
)
|
| 143 |
+
|
| 144 |
+
interface.queue(10).launch()
|