Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -36,7 +36,10 @@ Generate high-quality audio from text descriptions using TangoFlux.
|
|
36 |
tangoflux = TangoFluxInference(name="declare-lab/TangoFlux")
|
37 |
|
38 |
@spaces.GPU(duration=15)
|
39 |
-
def gradio_generate(prompt, steps, guidance, duration
|
|
|
|
|
|
|
40 |
output = tangoflux.generate(prompt, steps=steps, guidance_scale=guidance, duration=duration)
|
41 |
filename = 'temp.wav'
|
42 |
output = output[:,:int(duration*44100)]
|
@@ -60,95 +63,27 @@ gr_interface = gr.Interface(
|
|
60 |
flagging_mode="never", # Changed from allow_flagging=False
|
61 |
theme="soft",
|
62 |
examples=[
|
63 |
-
[
|
64 |
-
["
|
65 |
-
["
|
66 |
-
["
|
67 |
-
["
|
68 |
-
["
|
69 |
-
["
|
70 |
-
["
|
71 |
-
["
|
72 |
-
["
|
73 |
-
["
|
74 |
-
["
|
75 |
-
["
|
76 |
-
["
|
77 |
-
["
|
78 |
-
["
|
79 |
-
["
|
80 |
-
["
|
81 |
-
["
|
82 |
-
["
|
83 |
-
["
|
84 |
-
["Heavy helicopter blades chopping through air with engine and wind noise"],
|
85 |
-
["Dog barking excitedly and man shouting as race car engine roars past"],
|
86 |
-
["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!"],
|
87 |
-
["Melodic human whistling harmonizing with natural birdsong"],
|
88 |
-
["A parade marches through a town square, with drumbeats pounding, children clapping, and a horse neighing amidst the commotion"],
|
89 |
-
["Quiet speech and then and airplane flying away"],
|
90 |
-
["A soccer ball hits a goalpost with a metallic clang, followed by cheers, clapping, and the distant hum of a commentator's voice"],
|
91 |
-
["A basketball bounces rhythmically on a court, shoes squeak against the floor, and a referee's whistle cuts through the air"],
|
92 |
-
["Dripping water echoes sharply, a distant growl reverberates through the cavern, and soft scraping metal suggests something lurking unseen"],
|
93 |
-
["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."],
|
94 |
-
["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"],
|
95 |
-
["Gentle female voice cooing and baby responding with happy gurgles and giggles"],
|
96 |
-
['doorbell ding once followed by footsteps gradually getting louder and a door is opened '],
|
97 |
-
["A fork scrapes a plate, water drips slowly into a sink, and the faint hum of a refrigerator lingers in the background"],
|
98 |
-
["Powerful ocean waves crashing and receding on sandy beach with distant seagulls"],
|
99 |
-
["Emulate the lively sounds of a retro arcade: 8-bit game music, coins clinking. People cheering occasionally when players winning"],
|
100 |
-
["Simulate a forest ambiance with birds chirping and wind rustling through the leaves"],
|
101 |
-
["A train conductor blows a sharp whistle, metal wheels screech on the rails, and passengers murmur while settling into their seats"],
|
102 |
-
["Generate an energetic and bustling city street scene with distant traffic and close conversations"],
|
103 |
-
["Alarms blare with rising urgency as fragments clatter against a metallic hull, interrupted by a faint hiss of escaping air"],
|
104 |
-
["Create a serene soundscape of a quiet beach at sunset"],
|
105 |
-
["Tiny pops and hisses of chemical reactions intermingle with the rhythmic pumping of a centrifuge and the soft whirr of air filtration"],
|
106 |
-
["A train conductor blows a sharp whistle, metal wheels screech on the rails, and passengers murmur while settling into their seats"],
|
107 |
-
["Emulate the lively sounds of a retro arcade: 8-bit game music, coins clinking. People cheering occasionally when players winning"],
|
108 |
-
["Quiet whispered conversation gradually fading into distant jet engine roar diminishing into silence"],
|
109 |
-
["Clear sound of bicycle tires crunching on loose gravel and dirt, followed by deep male laughter echoing"],
|
110 |
-
["Multiple ducks quacking loudly with splashing water and piercing wild animal shriek in background"],
|
111 |
-
["Create the underwater soundscape: gentle waves, faint whale calls, and the occasional clink of scuba gear"],
|
112 |
-
["Recreate the sounds of an active volcano: rumbling earth, lava bubbling, and the occasional loud explosive roar of an eruption"],
|
113 |
-
["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"],
|
114 |
-
["Clear male voice speaking, sharp popping sound, followed by genuine group laughter"],
|
115 |
-
["Stream of water hitting empty ceramic cup, pitch rising as cup fills up"],
|
116 |
-
["Massive crowd erupting in thunderous applause and excited cheering"],
|
117 |
-
["Deep rolling thunder with bright lightning strikes crackling through sky"],
|
118 |
-
["Aggressive dog barking and distressed cat meowing as racing car roars past at high speed"],
|
119 |
-
["Peaceful stream bubbling and birds singing, interrupted by sudden explosive gunshot"],
|
120 |
-
["Man speaking outdoors, goat bleating loudly, metal gate scraping closed, ducks quacking frantically, wind howling into microphone"],
|
121 |
-
["Series of loud aggressive dog barks echoing"],
|
122 |
-
["Multiple distinct cat meows at different pitches"],
|
123 |
-
["Rhythmic wooden table tapping overlaid with steady water pouring sound"],
|
124 |
-
["Sustained crowd applause with camera clicks and amplified male announcer voice"],
|
125 |
-
["Two sharp gunshots followed by panicked birds taking flight with rapid wing flaps"],
|
126 |
-
["Deep rhythmic snoring with clear breathing patterns"],
|
127 |
-
["Multiple racing engines revving and accelerating with sharp whistle piercing through"],
|
128 |
-
["Massive stadium crowd cheering as thunder crashes and lightning strikes"],
|
129 |
-
["Heavy helicopter blades chopping through air with engine and wind noise"],
|
130 |
-
["Dog barking excitedly and man shouting as race car engine roars past"],
|
131 |
-
["A bicycle peddling on dirt and gravel followed by a man speaking then laughing"],
|
132 |
-
["Ducks quack and water splashes with some animal screeching in the background"],
|
133 |
-
["Describe the sound of the ocean"],
|
134 |
-
["A woman and a baby are having a conversation"],
|
135 |
-
["A man speaks followed by a popping noise and laughter"],
|
136 |
-
["A cup is filled from a faucet"],
|
137 |
-
["An audience cheering and clapping"],
|
138 |
-
["Rolling thunder with lightning strikes"],
|
139 |
-
["A dog barking and a cat mewing and a racing car passes by"],
|
140 |
-
["Gentle water stream, birds chirping and sudden gun shot"],
|
141 |
-
["A dog barking"],
|
142 |
-
["A cat meowing"],
|
143 |
-
["Wooden table tapping sound while water pouring"],
|
144 |
-
["Applause from a crowd with distant clicking and a man speaking over a loudspeaker"],
|
145 |
-
["two gunshots followed by birds flying away while chirping"],
|
146 |
-
["Whistling with birds chirping"],
|
147 |
-
["A person snoring"],
|
148 |
-
["Motor vehicles are driving with loud engines and a person whistles"],
|
149 |
-
["People cheering in a stadium while thunder and lightning strikes"],
|
150 |
-
["A helicopter is in flight"],
|
151 |
-
["A dog barking and a man talking and a racing car passes by"],
|
152 |
],
|
153 |
cache_examples="lazy",
|
154 |
)
|
|
|
36 |
tangoflux = TangoFluxInference(name="declare-lab/TangoFlux")
|
37 |
|
38 |
@spaces.GPU(duration=15)
|
39 |
+
def gradio_generate(prompt, steps, guidance, duration):
|
40 |
+
# Ensure duration has a default value if None
|
41 |
+
if duration is None:
|
42 |
+
duration = 10
|
43 |
output = tangoflux.generate(prompt, steps=steps, guidance_scale=guidance, duration=duration)
|
44 |
filename = 'temp.wav'
|
45 |
output = output[:,:int(duration*44100)]
|
|
|
63 |
flagging_mode="never", # Changed from allow_flagging=False
|
64 |
theme="soft",
|
65 |
examples=[
|
66 |
+
# [prompt, steps, guidance, duration]
|
67 |
+
["Quiet whispered conversation gradually fading into distant jet engine roar diminishing into silence", 25, 4.5, 10],
|
68 |
+
["Clear sound of bicycle tires crunching on loose gravel and dirt, followed by deep male laughter echoing", 25, 4.5, 10],
|
69 |
+
["Multiple ducks quacking loudly with splashing water and piercing wild animal shriek in background", 25, 4.5, 10],
|
70 |
+
["Powerful ocean waves crashing and receding on sandy beach with distant seagulls", 25, 4.5, 10],
|
71 |
+
["Gentle female voice cooing and baby responding with happy gurgles and giggles", 25, 4.5, 10],
|
72 |
+
["Clear male voice speaking, sharp popping sound, followed by genuine group laughter", 25, 4.5, 10],
|
73 |
+
["Stream of water hitting empty ceramic cup, pitch rising as cup fills up", 25, 4.5, 10],
|
74 |
+
["Massive crowd erupting in thunderous applause and excited cheering", 25, 4.5, 10],
|
75 |
+
["Deep rolling thunder with bright lightning strikes crackling through sky", 25, 4.5, 10],
|
76 |
+
["Aggressive dog barking and distressed cat meowing as racing car roars past at high speed", 25, 4.5, 10],
|
77 |
+
["Peaceful stream bubbling and birds singing, interrupted by sudden explosive gunshot", 25, 4.5, 10],
|
78 |
+
["Man speaking outdoors, goat bleating loudly, metal gate scraping closed, ducks quacking frantically, wind howling into microphone", 25, 4.5, 10],
|
79 |
+
["Series of loud aggressive dog barks echoing", 25, 4.5, 10],
|
80 |
+
["Multiple distinct cat meows at different pitches", 25, 4.5, 10],
|
81 |
+
["Rhythmic wooden table tapping overlaid with steady water pouring sound", 25, 4.5, 10],
|
82 |
+
["Sustained crowd applause with camera clicks and amplified male announcer voice", 25, 4.5, 10],
|
83 |
+
["Two sharp gunshots followed by panicked birds taking flight with rapid wing flaps", 25, 4.5, 10],
|
84 |
+
["Melodic human whistling harmonizing with natural birdsong", 25, 4.5, 10],
|
85 |
+
["Deep rhythmic snoring with clear breathing patterns", 25, 4.5, 10],
|
86 |
+
["Multiple racing engines revving and accelerating with sharp whistle piercing through", 25, 4.5, 10],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
],
|
88 |
cache_examples="lazy",
|
89 |
)
|