update web
Browse files
app.py
CHANGED
@@ -148,14 +148,6 @@ def generate_audio_gradio(
|
|
148 |
return x
|
149 |
audio = fade_out(audio, seq_cfg.sampling_rate)
|
150 |
|
151 |
-
# text_embed = laion_clap_model.get_text_embedding(prompt, use_tensor=True).squeeze()
|
152 |
-
# audio_embed = laion_clap_model.get_audio_embedding_from_data(audios[:,0,:].float().cpu(), use_tensor=True).squeeze()
|
153 |
-
# scores = torch.cosine_similarity(text_embed.expand(audio_embed.shape[0], -1),
|
154 |
-
# audio_embed,
|
155 |
-
# dim=-1)
|
156 |
-
# log.info(scores)
|
157 |
-
# log.info(torch.argmax(scores).item())
|
158 |
-
# audio = audios[torch.argmax(scores).item()].float().cpu()
|
159 |
safe_prompt = (
|
160 |
"".join(c for c in prompt if c.isalnum() or c in (" ", "_"))
|
161 |
.rstrip()
|
@@ -175,254 +167,344 @@ def generate_audio_gradio(
|
|
175 |
str(save_path),
|
176 |
)
|
177 |
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
)
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
#
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
#
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
#
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
#
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
#
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
#
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
#
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
#
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
#
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
}
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
}
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
}
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
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 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
426 |
|
427 |
if __name__ == "__main__":
|
428 |
demo.launch()
|
|
|
148 |
return x
|
149 |
audio = fade_out(audio, seq_cfg.sampling_rate)
|
150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
safe_prompt = (
|
152 |
"".join(c for c in prompt if c.isalnum() or c in (" ", "_"))
|
153 |
.rstrip()
|
|
|
167 |
str(save_path),
|
168 |
)
|
169 |
|
170 |
+
|
171 |
+
# Gradio input and output components
|
172 |
+
input_text = gr.Textbox(lines=2, label="Prompt")
|
173 |
+
output_audio = gr.Audio(label="Generated Audio", type="filepath")
|
174 |
+
denoising_steps = gr.Slider(minimum=1, maximum=50, value=1, step=5, label="Steps", interactive=True)
|
175 |
+
cfg_strength = gr.Slider(minimum=1, maximum=10, value=4.5, step=0.5, label="Guidance Scale (For MeanAudio, it is forced to 3 as integrated in training)", interactive=True)
|
176 |
+
duration = gr.Slider(minimum=1, maximum=30, value=10, step=1, label="Duration", interactive=True)
|
177 |
+
seed = gr.Slider(minimum=-1, maximum=1000000, value=42, step=1, label="Seed", interactive=True)
|
178 |
+
variant = gr.Dropdown(label="Model Variant", choices=list(all_model_cfg.keys()), value='meanaudio_s_full', interactive=True)
|
179 |
+
|
180 |
+
gr_interface = gr.Interface(
|
181 |
+
fn=generate_audio_gradio,
|
182 |
+
inputs=[input_text, None, duration, cfg_strength, denoising_steps, seed, variant],
|
183 |
+
outputs=["text", "audio"],
|
184 |
+
title="TangoFlux: Super Fast and Faithful Text to Audio Generation with Flow Matching and Clap-Ranked Preference Optimization",
|
185 |
+
description="",
|
186 |
+
allow_flagging=False,
|
187 |
+
examples=[
|
188 |
+
["Generate the festive sounds of a fireworks show: explosions lighting up the sky, crowd cheering, and the faint music playing in the background!! Celebration of the new year!"],
|
189 |
+
["Melodic human whistling harmonizing with natural birdsong"],
|
190 |
+
["A parade marches through a town square, with drumbeats pounding, children clapping, and a horse neighing amidst the commotion"],
|
191 |
+
["Quiet speech and then and airplane flying away"],
|
192 |
+
["A soccer ball hits a goalpost with a metallic clang, followed by cheers, clapping, and the distant hum of a commentator’s voice"],
|
193 |
+
["A basketball bounces rhythmically on a court, shoes squeak against the floor, and a referee’s whistle cuts through the air"],
|
194 |
+
["Dripping water echoes sharply, a distant growl reverberates through the cavern, and soft scraping metal suggests something lurking unseen"],
|
195 |
+
["A cow is mooing whilst a lion is roaring in the background as a hunter shoots. A flock of birds subsequently fly away from the trees."],
|
196 |
+
["The deep growl of an alligator ripples through the swamp as reeds sway with a soft rustle and a turtle splashes into the murky water"],
|
197 |
+
["Gentle female voice cooing and baby responding with happy gurgles and giggles"],
|
198 |
+
['doorbell ding once followed by footsteps gradually getting louder and a door is opened '],
|
199 |
+
["A fork scrapes a plate, water drips slowly into a sink, and the faint hum of a refrigerator lingers in the background"],
|
200 |
+
["Powerful ocean waves crashing and receding on sandy beach with distant seagulls"],
|
201 |
+
["Emulate the lively sounds of a retro arcade: 8-bit game music, coins clinking. People cheering occasionally when players winning"],
|
202 |
+
["Simulate a forest ambiance with birds chirping and wind rustling through the leaves"],
|
203 |
+
["A train conductor blows a sharp whistle, metal wheels screech on the rails, and passengers murmur while settling into their seats"],
|
204 |
+
["Generate an energetic and bustling city street scene with distant traffic and close conversations"],
|
205 |
+
["Alarms blare with rising urgency as fragments clatter against a metallic hull, interrupted by a faint hiss of escaping air"],
|
206 |
+
["Create a serene soundscape of a quiet beach at sunset"],
|
207 |
+
["Tiny pops and hisses of chemical reactions intermingle with the rhythmic pumping of a centrifuge and the soft whirr of air filtration"],
|
208 |
+
["A train conductor blows a sharp whistle, metal wheels screech on the rails, and passengers murmur while settling into their seats"],
|
209 |
+
["Emulate the lively sounds of a retro arcade: 8-bit game music, coins clinking. People cheering occasionally when players winning"],
|
210 |
+
["Quiet whispered conversation gradually fading into distant jet engine roar diminishing into silence"],
|
211 |
+
["Clear sound of bicycle tires crunching on loose gravel and dirt, followed by deep male laughter echoing"],
|
212 |
+
["Multiple ducks quacking loudly with splashing water and piercing wild animal shriek in background"],
|
213 |
+
["Create the underwater soundscape: gentle waves, faint whale calls, and the occasional clink of scuba gear"],
|
214 |
+
["Recreate the sounds of an active volcano: rumbling earth, lava bubbling, and the occasional loud explosive roar of an eruption"],
|
215 |
+
["A pile of coins spills onto a wooden table with a metallic clatter, followed by the hushed murmur of a tavern crowd and the creak of a swinging door"],
|
216 |
+
["Clear male voice speaking, sharp popping sound, followed by genuine group laughter"],
|
217 |
+
["Stream of water hitting empty ceramic cup, pitch rising as cup fills up"],
|
218 |
+
["Massive crowd erupting in thunderous applause and excited cheering"],
|
219 |
+
["Deep rolling thunder with bright lightning strikes crackling through sky"],
|
220 |
+
["Aggressive dog barking and distressed cat meowing as racing car roars past at high speed"],
|
221 |
+
["Peaceful stream bubbling and birds singing, interrupted by sudden explosive gunshot"],
|
222 |
+
["Man speaking outdoors, goat bleating loudly, metal gate scraping closed, ducks quacking frantically, wind howling into microphone"],
|
223 |
+
["Series of loud aggressive dog barks echoing"],
|
224 |
+
["Multiple distinct cat meows at different pitches"],
|
225 |
+
["Rhythmic wooden table tapping overlaid with steady water pouring sound"],
|
226 |
+
["Sustained crowd applause with camera clicks and amplified male announcer voice"],
|
227 |
+
["Two sharp gunshots followed by panicked birds taking flight with rapid wing flaps"],
|
228 |
+
["Deep rhythmic snoring with clear breathing patterns"],
|
229 |
+
["Multiple racing engines revving and accelerating with sharp whistle piercing through"],
|
230 |
+
["Massive stadium crowd cheering as thunder crashes and lightning strikes"],
|
231 |
+
["Heavy helicopter blades chopping through air with engine and wind noise"],
|
232 |
+
["Dog barking excitedly and man shouting as race car engine roars past"],
|
233 |
+
["A bicycle peddling on dirt and gravel followed by a man speaking then laughing"],
|
234 |
+
["Ducks quack and water splashes with some animal screeching in the background"],
|
235 |
+
["Describe the sound of the ocean"],
|
236 |
+
["A woman and a baby are having a conversation"],
|
237 |
+
["A man speaks followed by a popping noise and laughter"],
|
238 |
+
["A cup is filled from a faucet"],
|
239 |
+
["An audience cheering and clapping"],
|
240 |
+
["Rolling thunder with lightning strikes"],
|
241 |
+
["A dog barking and a cat mewing and a racing car passes by"],
|
242 |
+
["Gentle water stream, birds chirping and sudden gun shot"],
|
243 |
+
["A dog barking"],
|
244 |
+
["A cat meowing"],
|
245 |
+
["Wooden table tapping sound while water pouring"],
|
246 |
+
["Applause from a crowd with distant clicking and a man speaking over a loudspeaker"],
|
247 |
+
["two gunshots followed by birds flying away while chirping"],
|
248 |
+
["Whistling with birds chirping"],
|
249 |
+
["A person snoring"],
|
250 |
+
["Motor vehicles are driving with loud engines and a person whistles"],
|
251 |
+
["People cheering in a stadium while thunder and lightning strikes"],
|
252 |
+
["A helicopter is in flight"],
|
253 |
+
["A dog barking and a man talking and a racing car passes by"],
|
254 |
+
],
|
255 |
+
cache_examples="lazy", # Turn on to cache.
|
256 |
)
|
257 |
+
|
258 |
+
|
259 |
+
|
260 |
+
# theme = gr.themes.Soft(
|
261 |
+
# primary_hue="blue",
|
262 |
+
# secondary_hue="slate",
|
263 |
+
# neutral_hue="slate",
|
264 |
+
# text_size="sm",
|
265 |
+
# spacing_size="sm",
|
266 |
+
# ).set(
|
267 |
+
# background_fill_primary="*neutral_50",
|
268 |
+
# background_fill_secondary="*background_fill_primary",
|
269 |
+
# block_background_fill="*background_fill_primary",
|
270 |
+
# block_border_width="0px",
|
271 |
+
# panel_background_fill="*neutral_50",
|
272 |
+
# panel_border_width="0px",
|
273 |
+
# input_background_fill="*neutral_100",
|
274 |
+
# input_border_color="*neutral_200",
|
275 |
+
# button_primary_background_fill="*primary_300",
|
276 |
+
# button_primary_background_fill_hover="*primary_400",
|
277 |
+
# button_secondary_background_fill="*neutral_200",
|
278 |
+
# button_secondary_background_fill_hover="*neutral_300",
|
279 |
+
# )
|
280 |
+
# custom_css = """
|
281 |
+
# #main-headertitle {
|
282 |
+
# text-align: center;
|
283 |
+
# margin-top: 15px;
|
284 |
+
# margin-bottom: 10px;
|
285 |
+
# color: var(--neutral-600);
|
286 |
+
# font-weight: 600;
|
287 |
+
# }
|
288 |
+
# #main-header {
|
289 |
+
# text-align: center;
|
290 |
+
# margin-top: 5px;
|
291 |
+
# margin-bottom: 10px;
|
292 |
+
# color: var(--neutral-600);
|
293 |
+
# font-weight: 600;
|
294 |
+
# }
|
295 |
+
# #model-settings-header, #generation-settings-header {
|
296 |
+
# color: var(--neutral-600);
|
297 |
+
# margin-top: 8px;
|
298 |
+
# margin-bottom: 8px;
|
299 |
+
# font-weight: 500;
|
300 |
+
# font-size: 1.1em;
|
301 |
+
# }
|
302 |
+
# .setting-section {
|
303 |
+
# padding: 10px 12px;
|
304 |
+
# border-radius: 6px;
|
305 |
+
# background-color: var(--neutral-50);
|
306 |
+
# margin-bottom: 10px;
|
307 |
+
# border: 1px solid var(--neutral-100);
|
308 |
+
# }
|
309 |
+
# hr {
|
310 |
+
# border: none;
|
311 |
+
# height: 1px;
|
312 |
+
# background-color: var(--neutral-200);
|
313 |
+
# margin: 8px 0;
|
314 |
+
# }
|
315 |
+
# #generate-btn {
|
316 |
+
# width: 100%;
|
317 |
+
# max-width: 250px;
|
318 |
+
# margin: 10px auto;
|
319 |
+
# display: block;
|
320 |
+
# padding: 10px 15px;
|
321 |
+
# font-size: 16px;
|
322 |
+
# border-radius: 5px;
|
323 |
+
# }
|
324 |
+
# #status-box {
|
325 |
+
# min-height: 50px;
|
326 |
+
# display: flex;
|
327 |
+
# align-items: center;
|
328 |
+
# justify-content: center;
|
329 |
+
# padding: 8px;
|
330 |
+
# border-radius: 5px;
|
331 |
+
# border: 1px solid var(--neutral-200);
|
332 |
+
# color: var(--neutral-700);
|
333 |
+
# }
|
334 |
+
# #project-badges {
|
335 |
+
# text-align: center;
|
336 |
+
# margin-top: 30px;
|
337 |
+
# margin-bottom: 20px;
|
338 |
+
# }
|
339 |
+
# #project-badges #badge-container {
|
340 |
+
# display: flex;
|
341 |
+
# gap: 10px;
|
342 |
+
# align-items: center;
|
343 |
+
# justify-content: center;
|
344 |
+
# flex-wrap: wrap;
|
345 |
+
# }
|
346 |
+
# #project-badges img {
|
347 |
+
# border-radius: 5px;
|
348 |
+
# box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
349 |
+
# height: 20px;
|
350 |
+
# transition: transform 0.1s ease, box-shadow 0.1s ease;
|
351 |
+
# }
|
352 |
+
# #project-badges a:hover img {
|
353 |
+
# transform: translateY(-2px);
|
354 |
+
# box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
|
355 |
+
# }
|
356 |
+
# #audio-output {
|
357 |
+
# height: 200px;
|
358 |
+
# border-radius: 5px;
|
359 |
+
# border: 1px solid var(--neutral-200);
|
360 |
+
# }
|
361 |
+
# .gradio-dropdown label, .gradio-checkbox label, .gradio-number label, .gradio-textbox label {
|
362 |
+
# font-weight: 500;
|
363 |
+
# color: var(--neutral-700);
|
364 |
+
# font-size: 0.9em;
|
365 |
+
# }
|
366 |
+
# .gradio-row {
|
367 |
+
# gap: 8px;
|
368 |
+
# }
|
369 |
+
# .gradio-block {
|
370 |
+
# margin-bottom: 8px;
|
371 |
+
# }
|
372 |
+
# .setting-section .gradio-block {
|
373 |
+
# margin-bottom: 6px;
|
374 |
+
# }
|
375 |
+
# ::-webkit-scrollbar {
|
376 |
+
# width: 8px;
|
377 |
+
# height: 8px;
|
378 |
+
# }
|
379 |
+
# ::-webkit-scrollbar-track {
|
380 |
+
# background: var(--neutral-100);
|
381 |
+
# border-radius: 4px;
|
382 |
+
# }
|
383 |
+
# ::-webkit-scrollbar-thumb {
|
384 |
+
# background: var(--neutral-300);
|
385 |
+
# border-radius: 4px;
|
386 |
+
# }
|
387 |
+
# ::-webkit-scrollbar-thumb:hover {
|
388 |
+
# background: var(--neutral-400);
|
389 |
+
# }
|
390 |
+
# * {
|
391 |
+
# scrollbar-width: thin;
|
392 |
+
# scrollbar-color: var(--neutral-300) var(--neutral-100);
|
393 |
+
# }
|
394 |
+
# """
|
395 |
+
# with gr.Blocks(title="MeanAudio Generator", theme=theme, css=custom_css) as demo:
|
396 |
+
# gr.Markdown("# MeanAudio: Fast and Faithful Text-to-Audio Generation with Mean Flows", elem_id="main-header")
|
397 |
+
# badge_html = '''
|
398 |
+
# <div id="project-badges"> <!-- 使用 ID
|
399 |
+
# 以便应用 CSS -->
|
400 |
+
# <div id="badge-container"> <!-- 添加这个容器 div 并使用 ID -->
|
401 |
+
# <a href="https://huggingface.co/junxiliu/MeanAudio">
|
402 |
+
# <img src="https://img.shields.io/badge/Model-HuggingFace-violet?logo=huggingface" alt="Hugging Face Model">
|
403 |
+
# </a>
|
404 |
+
# <a href="https://huggingface.co/spaces/chenxie95/MeanAudio">
|
405 |
+
# <img src="https://img.shields.io/badge/Space-HuggingFace-8A2BE2?logo=huggingface" alt="Hugging Face Space">
|
406 |
+
# </a>
|
407 |
+
# <a href="https://meanaudio.github.io/">
|
408 |
+
# <img src="https://img.shields.io/badge/Project-Page-brightred?style=flat" alt="Project Page">
|
409 |
+
# </a>
|
410 |
+
# <a href="https://github.com/xiquan-li/MeanAudio">
|
411 |
+
# <img src="https://img.shields.io/badge/Code-GitHub-black?logo=github" alt="GitHub">
|
412 |
+
# </a>
|
413 |
+
# </div>
|
414 |
+
# </div>
|
415 |
+
# '''
|
416 |
+
# gr.HTML(badge_html)
|
417 |
+
# with gr.Column(elem_classes="setting-section"):
|
418 |
+
# with gr.Row():
|
419 |
+
# available_variants = (
|
420 |
+
# list(all_model_cfg.keys()) if all_model_cfg else []
|
421 |
+
# )
|
422 |
+
# default_variant = (
|
423 |
+
# 'meanaudio_mf'
|
424 |
+
# )
|
425 |
+
# variant = gr.Dropdown(
|
426 |
+
# label="Model Variant",
|
427 |
+
# choices=available_variants,
|
428 |
+
# value=default_variant,
|
429 |
+
# interactive=True,
|
430 |
+
# scale=3,
|
431 |
+
# )
|
432 |
+
# with gr.Column(elem_classes="setting-section"):
|
433 |
+
# with gr.Row():
|
434 |
+
# prompt = gr.Textbox(
|
435 |
+
# label="Prompt",
|
436 |
+
# placeholder="Describe the sound you want to generate...",
|
437 |
+
# scale=1,
|
438 |
+
# )
|
439 |
+
# negative_prompt = gr.Textbox(
|
440 |
+
# label="Negative Prompt",
|
441 |
+
# placeholder="Describe sounds you want to avoid...",
|
442 |
+
# value="",
|
443 |
+
# scale=1,
|
444 |
+
# )
|
445 |
+
# with gr.Row():
|
446 |
+
# duration = gr.Number(
|
447 |
+
# label="Duration (sec)", value=10.0, minimum=0.1, scale=1
|
448 |
+
# )
|
449 |
+
# cfg_strength = gr.Number(
|
450 |
+
# label="CFG (Meanflow forced to 3)", value=3, minimum=0.0, scale=1
|
451 |
+
# )
|
452 |
+
# with gr.Row():
|
453 |
+
# seed = gr.Number(
|
454 |
+
# label="Seed (-1 for random)", value=42, precision=0, scale=1
|
455 |
+
# )
|
456 |
+
# num_steps = gr.Number(
|
457 |
+
# label="Number of Steps",
|
458 |
+
# value=1,
|
459 |
+
# precision=0,
|
460 |
+
# minimum=1,
|
461 |
+
# scale=1,
|
462 |
+
# )
|
463 |
+
# generate_button = gr.Button("Generate", variant="primary", elem_id="generate-btn")
|
464 |
+
# generate_output_text = gr.Textbox(
|
465 |
+
# label="Result Status", interactive=False, elem_id="status-box"
|
466 |
+
# )
|
467 |
+
# audio_output = gr.Audio(
|
468 |
+
# label="Generated Audio", type="filepath", elem_id="audio-output"
|
469 |
+
# )
|
470 |
+
# generate_button.click(
|
471 |
+
# fn=generate_audio_gradio,
|
472 |
+
# inputs=[
|
473 |
+
# prompt,
|
474 |
+
# negative_prompt,
|
475 |
+
# duration,
|
476 |
+
# cfg_strength,
|
477 |
+
# num_steps,
|
478 |
+
# seed,
|
479 |
+
# variant,
|
480 |
+
# ],
|
481 |
+
# outputs=[generate_output_text, audio_output],
|
482 |
+
# )
|
483 |
+
# audio_examples = [
|
484 |
+
# ["Typing on a keyboard", "", 10.0, 3, 1, 42, "meanaudio_mf"],
|
485 |
+
# ["A man speaks followed by a popping noise and laughter", "", 10.0, 3, 1, 42, "meanaudio_mf"],
|
486 |
+
# ["Some humming followed by a toilet flushing", "", 10.0, 3, 2, 42, "meanaudio_mf"],
|
487 |
+
# ["Rain falling on a hard surface as thunder roars in the distance", "", 10.0, 3, 5, 42, "meanaudio_mf"],
|
488 |
+
# ["Food sizzling and oil popping", "", 10.0, 3, 25, 42, "meanaudio_mf"],
|
489 |
+
# ["Pots and dishes clanking as a man talks followed by liquid pouring into a container", "", 8.0, 3, 2, 42, "meanaudio_mf"],
|
490 |
+
# ["A few seconds of silence then a rasping sound against wood", "", 12.0, 3, 2, 42, "meanaudio_mf"],
|
491 |
+
# ["A man speaks as he gives a speech and then the crowd cheers", "", 10.0, 3, 25, 42, "fluxaudio_fm"],
|
492 |
+
# ["A goat bleating repeatedly", "", 10.0, 3, 50, 123, "fluxaudio_fm"],
|
493 |
+
# ["A speech and gunfire followed by a gun being loaded", "", 10.0, 3, 1, 42, "meanaudio_mf"],
|
494 |
+
# ["Tires squealing followed by an engine revving", "", 12.0, 4, 25, 456, "fluxaudio_fm"],
|
495 |
+
# ["Hammer slowly hitting the wooden table", "", 10.0, 3.5, 25, 42, "fluxaudio_fm"],
|
496 |
+
# ["Dog barking excitedly and man shouting as race car engine roars past", "", 10.0, 3, 1, 42, "meanaudio_mf"],
|
497 |
+
# ["A dog barking and a cat mewing and a racing car passes by", "", 12.0, 3, 5, -1, "meanaudio_mf"],
|
498 |
+
# ["Whistling with birds chirping", "", 10.0, 4, 50, 42, "fluxaudio_fm"],
|
499 |
+
# ]
|
500 |
+
# gr.Examples(
|
501 |
+
# examples=audio_examples,
|
502 |
+
# inputs=[prompt, negative_prompt, duration, cfg_strength, num_steps, seed, variant],
|
503 |
+
# #outputs=[generate_output_text, audio_output],
|
504 |
+
# #fn=generate_audio_gradio,
|
505 |
+
# examples_per_page=5,
|
506 |
+
# label="Example Prompts",
|
507 |
+
# )
|
508 |
|
509 |
if __name__ == "__main__":
|
510 |
demo.launch()
|