Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -255,16 +255,8 @@ def run(audio_files, file_m, file_index):
|
|
255 |
|
256 |
|
257 |
def process_audio(audio_files, file_m, file_index):
|
258 |
-
result
|
259 |
-
|
260 |
-
# Create a list of Audio components with filenames as labels
|
261 |
-
audio_outputs = [
|
262 |
-
gr.Audio(value=audio_path, label=os.path.basename(audio_path), visible=True, show_share_button=False)
|
263 |
-
for audio_path in result
|
264 |
-
]
|
265 |
-
|
266 |
-
return audio_outputs, result
|
267 |
-
|
268 |
|
269 |
|
270 |
|
@@ -314,25 +306,19 @@ def get_gui(theme):
|
|
314 |
model = model_conf()
|
315 |
indx = index_conf()
|
316 |
button_base = button_conf()
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
[output_audio]
|
325 |
-
)
|
326 |
|
327 |
-
# Handle the processing and output generation
|
328 |
button_base.click(
|
329 |
-
process_audio,
|
330 |
inputs=[aud, model, indx],
|
331 |
-
outputs=[output_audio
|
332 |
-
|
333 |
-
lambda audio_outputs: gr.update(visible=True),
|
334 |
-
inputs=[output_audio],
|
335 |
-
outputs=[output_audio]
|
336 |
)
|
337 |
|
338 |
gr.Examples(
|
@@ -342,12 +328,13 @@ def get_gui(theme):
|
|
342 |
],
|
343 |
fn=process_audio,
|
344 |
inputs=[aud, model, indx],
|
345 |
-
outputs=[output_audio
|
346 |
cache_examples=False,
|
347 |
)
|
348 |
|
349 |
return app
|
350 |
|
|
|
351 |
if __name__ == "__main__":
|
352 |
app = get_gui(theme)
|
353 |
app.queue(default_concurrency_limit=40)
|
@@ -358,4 +345,4 @@ if __name__ == "__main__":
|
|
358 |
quiet=False,
|
359 |
debug=False,
|
360 |
allowed_paths=["./downloads/"],
|
361 |
-
)
|
|
|
255 |
|
256 |
|
257 |
def process_audio(audio_files, file_m, file_index):
|
258 |
+
result = run(audio_files, file_m, file_index)
|
259 |
+
return result # Only return the processed results
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
260 |
|
261 |
|
262 |
|
|
|
306 |
model = model_conf()
|
307 |
indx = index_conf()
|
308 |
button_base = button_conf()
|
309 |
+
output_audio = gr.Column(visible=True) # This will hold dynamically created audio components
|
310 |
+
|
311 |
+
def display_audio_files(audio_paths):
|
312 |
+
audio_components = []
|
313 |
+
for audio_path in audio_paths:
|
314 |
+
audio_components.append(gr.Audio(value=audio_path, label=os.path.basename(audio_path), visible=True))
|
315 |
+
return audio_components
|
|
|
|
|
316 |
|
|
|
317 |
button_base.click(
|
318 |
+
fn=process_audio,
|
319 |
inputs=[aud, model, indx],
|
320 |
+
outputs=[output_audio],
|
321 |
+
_js=display_audio_files # Function to dynamically create and display audio components
|
|
|
|
|
|
|
322 |
)
|
323 |
|
324 |
gr.Examples(
|
|
|
328 |
],
|
329 |
fn=process_audio,
|
330 |
inputs=[aud, model, indx],
|
331 |
+
outputs=[output_audio],
|
332 |
cache_examples=False,
|
333 |
)
|
334 |
|
335 |
return app
|
336 |
|
337 |
+
|
338 |
if __name__ == "__main__":
|
339 |
app = get_gui(theme)
|
340 |
app.queue(default_concurrency_limit=40)
|
|
|
345 |
quiet=False,
|
346 |
debug=False,
|
347 |
allowed_paths=["./downloads/"],
|
348 |
+
)
|