Fabrice-TIERCELIN commited on
Commit
da24da3
1 Parent(s): fbf5d25

Display as many output as generated

Browse files
Files changed (1) hide show
  1. app.py +32 -28
app.py CHANGED
@@ -86,10 +86,10 @@ tango.model.to(device_type)
86
  @spaces.GPU(duration=120)
87
  def gradio_generate(
88
  prompt,
89
- output_format,
90
- output_number,
91
- steps,
92
- guidance
93
  ):
94
  output_wave = tango.generate(prompt, steps, guidance, output_number)
95
  # output_filename = f"{prompt.replace(' ', '_')}_{steps}_{guidance}"[:250] + ".wav"
@@ -121,7 +121,11 @@ def gradio_generate(
121
  else:
122
  output_filename_3 = None
123
 
124
- return [output_filename_1, output_filename_2, output_filename_3]
 
 
 
 
125
 
126
  # description_text = """
127
  # <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/>
@@ -167,29 +171,29 @@ gr_interface = gr.Interface(
167
  description=description_text,
168
  allow_flagging=False,
169
  examples=[
170
- ["Quiet speech and then and airplane flying away"],
171
- ["A bicycle peddling on dirt and gravel followed by a man speaking then laughing"],
172
- ["Ducks quack and water splashes with some animal screeching in the background"],
173
- ["Describe the sound of the ocean"],
174
- ["A woman and a baby are having a conversation"],
175
- ["A man speaks followed by a popping noise and laughter"],
176
- ["A cup is filled from a faucet"],
177
- ["An audience cheering and clapping"],
178
- ["Rolling thunder with lightning strikes"],
179
- ["A dog barking and a cat mewing and a racing car passes by"],
180
- ["Gentle water stream, birds chirping and sudden gun shot"],
181
- ["A man talking followed by a goat baaing then a metal gate sliding shut as ducks quack and wind blows into a microphone."],
182
- ["A dog barking"],
183
- ["A cat meowing"],
184
- ["Wooden table tapping sound while water pouring"],
185
- ["Applause from a crowd with distant clicking and a man speaking over a loudspeaker"],
186
- ["two gunshots followed by birds flying away while chirping"],
187
- ["Whistling with birds chirping"],
188
- ["A person snoring"],
189
- ["Motor vehicles are driving with loud engines and a person whistles"],
190
- ["People cheering in a stadium while thunder and lightning strikes"],
191
- ["A helicopter is in flight"],
192
- ["A dog barking and a man talking and a racing car passes by"],
193
  ],
194
  cache_examples="lazy", # Turn on to cache.
195
  )
 
86
  @spaces.GPU(duration=120)
87
  def gradio_generate(
88
  prompt,
89
+ output_format="wav",
90
+ output_number=3,
91
+ steps=100,
92
+ guidance=3
93
  ):
94
  output_wave = tango.generate(prompt, steps, guidance, output_number)
95
  # output_filename = f"{prompt.replace(' ', '_')}_{steps}_{guidance}"[:250] + ".wav"
 
121
  else:
122
  output_filename_3 = None
123
 
124
+ return [
125
+ gr.update(value = output_filename_1),
126
+ gr.update(value = output_filename_2, visible = (2 <= output_number)),
127
+ gr.update(value = output_filename_3, visible = (output_number == 3))
128
+ ]
129
 
130
  # description_text = """
131
  # <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/>
 
171
  description=description_text,
172
  allow_flagging=False,
173
  examples=[
174
+ ["Quiet speech and then and airplane flying away", "wav", 1, 100, 3],
175
+ ["A bicycle peddling on dirt and gravel followed by a man speaking then laughing", "wav", 1, 100, 3],
176
+ ["Ducks quack and water splashes with some animal screeching in the background", "wav", 1, 100, 3],
177
+ ["Describe the sound of the ocean", "wav", 1, 100, 3],
178
+ ["A woman and a baby are having a conversation", "wav", 1, 100, 3],
179
+ ["A man speaks followed by a popping noise and laughter", "wav", 1, 100, 3],
180
+ ["A cup is filled from a faucet", "wav", 1, 100, 3],
181
+ ["An audience cheering and clapping", "wav", 1, 100, 3],
182
+ ["Rolling thunder with lightning strikes", "wav", 1, 100, 3],
183
+ ["A dog barking and a cat mewing and a racing car passes by", "wav", 1, 100, 3],
184
+ ["Gentle water stream, birds chirping and sudden gun shot", "wav", 1, 100, 3],
185
+ ["A man talking followed by a goat baaing then a metal gate sliding shut as ducks quack and wind blows into a microphone.", "wav", 1, 100, 3],
186
+ ["A dog barking", "wav", 1, 100, 3],
187
+ ["A cat meowing", "wav", 1, 100, 3],
188
+ ["Wooden table tapping sound while water pouring", "wav", 1, 100, 3],
189
+ ["Applause from a crowd with distant clicking and a man speaking over a loudspeaker", "wav", 1, 100, 3],
190
+ ["two gunshots followed by birds flying away while chirping", "wav", 1, 100, 3],
191
+ ["Whistling with birds chirping", "wav", 1, 100, 3],
192
+ ["A person snoring", "wav", 1, 100, 3],
193
+ ["Motor vehicles are driving with loud engines and a person whistles", "wav", 1, 100, 3],
194
+ ["People cheering in a stadium while thunder and lightning strikes", "wav", 1, 100, 3],
195
+ ["A helicopter is in flight", "wav", 1, 100, 3],
196
+ ["A dog barking and a man talking and a racing car passes by", "wav", 1, 100, 3],
197
  ],
198
  cache_examples="lazy", # Turn on to cache.
199
  )