Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -265,31 +265,7 @@ def gradio_generate(prompt, output_format, steps, guidance):
|
|
265 |
|
266 |
return output_filename
|
267 |
|
268 |
-
|
269 |
-
# <p><a href="https://huggingface.co/spaces/declare-lab/tango/blob/main/app.py?duplicate=true"> <img style="margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a> For faster inference without waiting in queue, you may duplicate the space and upgrade to a GPU in the settings. <br/><br/>
|
270 |
-
# Generate audio using TANGO by providing a text prompt.
|
271 |
-
# <br/><br/>Limitations: TANGO is trained on the small AudioCaps dataset so it may not generate good audio \
|
272 |
-
# samples related to concepts that it has not seen in training (e.g. singing). For the same reason, TANGO \
|
273 |
-
# is not always able to finely control its generations over textual control prompts. For example, \
|
274 |
-
# the generations from TANGO for prompts Chopping tomatoes on a wooden table and Chopping potatoes \
|
275 |
-
# on a metal table are very similar. \
|
276 |
-
# <br/><br/>We are currently training another version of TANGO on larger datasets to enhance its generalization, \
|
277 |
-
# compositional and controllable generation ability.
|
278 |
-
# <br/><br/>We recommend using a guidance scale of 3. The default number of steps is set to 100. More steps generally lead to better quality of generated audios but will take longer.
|
279 |
-
# <br/><br/>
|
280 |
-
# <h1> ChatGPT-enhanced audio generation</h1>
|
281 |
-
# <br/>
|
282 |
-
# As TANGO consists of an instruction-tuned LLM, it is able to process complex sound descriptions allowing us to provide more detailed instructions to improve the generation quality.
|
283 |
-
# For example, ``A boat is moving on the sea'' vs ``The sound of the water lapping against the hull of the boat or splashing as you move through the waves''. The latter is obtained by prompting ChatGPT to explain the sound generated when a boat moves on the sea.
|
284 |
-
# Using this ChatGPT-generated description of the sound, TANGO provides superior results.
|
285 |
-
# <p/>
|
286 |
-
# """
|
287 |
-
description_text = """
|
288 |
-
<p><a href="https://huggingface.co/spaces/declare-lab/tango2/blob/main/app.py?duplicate=true"> <img style="margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a> For faster inference without waiting in queue, you may duplicate the space and upgrade to a GPU in the settings. <br/><br/>
|
289 |
-
Generate audio using Tango2 by providing a text prompt. Tango2 was built from Tango and was trained on <a href="https://huggingface.co/datasets/declare-lab/audio-alpaca">Audio-alpaca</a>
|
290 |
-
<br/><br/> This is the demo for Tango2 for text to audio generation: <a href="https://arxiv.org/abs/2404.09956">Read our paper.</a>
|
291 |
-
<p/>
|
292 |
-
"""
|
293 |
# Gradio input and output components
|
294 |
input_text = gr.Textbox(lines=2, label="Prompt")
|
295 |
output_format = gr.Radio(label = "Output format", info = "The file you can dowload", choices = ["mp3", "wav"], value = "wav")
|
@@ -303,32 +279,31 @@ gr_interface = gr.Interface(
|
|
303 |
inputs=[input_text, output_format, denoising_steps, guidance_scale],
|
304 |
outputs=[output_audio],
|
305 |
title="Tango 2: Aligning Diffusion-based Text-to-Audio Generations through Direct Preference Optimization",
|
306 |
-
description=description_text,
|
307 |
allow_flagging=False,
|
308 |
examples=[
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
],
|
333 |
cache_examples="lazy", # Turn on to cache.
|
334 |
)
|
|
|
265 |
|
266 |
return output_filename
|
267 |
|
268 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
# Gradio input and output components
|
270 |
input_text = gr.Textbox(lines=2, label="Prompt")
|
271 |
output_format = gr.Radio(label = "Output format", info = "The file you can dowload", choices = ["mp3", "wav"], value = "wav")
|
|
|
279 |
inputs=[input_text, output_format, denoising_steps, guidance_scale],
|
280 |
outputs=[output_audio],
|
281 |
title="Tango 2: Aligning Diffusion-based Text-to-Audio Generations through Direct Preference Optimization",
|
|
|
282 |
allow_flagging=False,
|
283 |
examples=[
|
284 |
+
["Quiet whispered conversation gradually fading into distant jet engine roar diminishing into silence"],
|
285 |
+
["Clear sound of bicycle tires crunching on loose gravel and dirt, followed by deep male laughter echoing"],
|
286 |
+
["Multiple ducks quacking loudly with splashing water and piercing wild animal shriek in background"],
|
287 |
+
["Powerful ocean waves crashing and receding on sandy beach with distant seagulls"],
|
288 |
+
["Gentle female voice cooing and baby responding with happy gurgles and giggles"],
|
289 |
+
["Clear male voice speaking, sharp popping sound, followed by genuine group laughter"],
|
290 |
+
["Stream of water hitting empty ceramic cup, pitch rising as cup fills up"],
|
291 |
+
["Massive crowd erupting in thunderous applause and excited cheering"],
|
292 |
+
["Deep rolling thunder with bright lightning strikes crackling through sky"],
|
293 |
+
["Aggressive dog barking and distressed cat meowing as racing car roars past at high speed"],
|
294 |
+
["Peaceful stream bubbling and birds singing, interrupted by sudden explosive gunshot"],
|
295 |
+
["Man speaking outdoors, goat bleating loudly, metal gate scraping closed, ducks quacking frantically, wind howling into microphone"],
|
296 |
+
["Series of loud aggressive dog barks echoing"],
|
297 |
+
["Multiple distinct cat meows at different pitches"],
|
298 |
+
["Rhythmic wooden table tapping overlaid with steady water pouring sound"],
|
299 |
+
["Sustained crowd applause with camera clicks and amplified male announcer voice"],
|
300 |
+
["Two sharp gunshots followed by panicked birds taking flight with rapid wing flaps"],
|
301 |
+
["Melodic human whistling harmonizing with natural birdsong"],
|
302 |
+
["Deep rhythmic snoring with clear breathing patterns"],
|
303 |
+
["Multiple racing engines revving and accelerating with sharp whistle piercing through"],
|
304 |
+
["Massive stadium crowd cheering as thunder crashes and lightning strikes"],
|
305 |
+
["Heavy helicopter blades chopping through air with engine and wind noise"],
|
306 |
+
["Dog barking excitedly and man shouting as race car engine roars past"]
|
307 |
],
|
308 |
cache_examples="lazy", # Turn on to cache.
|
309 |
)
|