fantos commited on
Commit
7cb4a2e
1 Parent(s): 348f0d7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -49
app.py CHANGED
@@ -265,31 +265,7 @@ def gradio_generate(prompt, output_format, steps, guidance):
265
 
266
  return output_filename
267
 
268
- # description_text = """
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
- ["Quiet speech and then and airplane flying away"],
310
- ["A bicycle peddling on dirt and gravel followed by a man speaking then laughing"],
311
- ["Ducks quack and water splashes with some animal screeching in the background"],
312
- ["Describe the sound of the ocean"],
313
- ["A woman and a baby are having a conversation"],
314
- ["A man speaks followed by a popping noise and laughter"],
315
- ["A cup is filled from a faucet"],
316
- ["An audience cheering and clapping"],
317
- ["Rolling thunder with lightning strikes"],
318
- ["A dog barking and a cat mewing and a racing car passes by"],
319
- ["Gentle water stream, birds chirping and sudden gun shot"],
320
- ["A man talking followed by a goat baaing then a metal gate sliding shut as ducks quack and wind blows into a microphone."],
321
- ["A dog barking"],
322
- ["A cat meowing"],
323
- ["Wooden table tapping sound while water pouring"],
324
- ["Applause from a crowd with distant clicking and a man speaking over a loudspeaker"],
325
- ["two gunshots followed by birds flying away while chirping"],
326
- ["Whistling with birds chirping"],
327
- ["A person snoring"],
328
- ["Motor vehicles are driving with loud engines and a person whistles"],
329
- ["People cheering in a stadium while thunder and lightning strikes"],
330
- ["A helicopter is in flight"],
331
- ["A dog barking and a man talking and a racing car passes by"],
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
  )