Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -255,7 +255,7 @@ 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 = [
|
@@ -265,13 +265,8 @@ def process_audio(audio_files, file_m, file_index):
|
|
265 |
|
266 |
return result, audio_outputs
|
267 |
|
268 |
-
def update_audio_column(audio_outputs):
|
269 |
-
return gr.update(visible=True), audio_outputs
|
270 |
|
271 |
|
272 |
-
def reset_audio_column():
|
273 |
-
return gr.update(visible=False), []
|
274 |
-
|
275 |
|
276 |
|
277 |
|
@@ -307,8 +302,9 @@ def button_conf():
|
|
307 |
variant="primary",
|
308 |
)
|
309 |
|
|
|
310 |
def output_conf():
|
311 |
-
return gr.File(label="Result", file_count="multiple", interactive=False), gr.
|
312 |
|
313 |
|
314 |
def get_gui(theme):
|
@@ -319,15 +315,16 @@ def get_gui(theme):
|
|
319 |
model = model_conf()
|
320 |
indx = index_conf()
|
321 |
button_base = button_conf()
|
322 |
-
output_file =
|
323 |
-
output_audio = gr.Column(visible=False) # Column to hold multiple audio players
|
324 |
|
|
|
325 |
aud.change(
|
326 |
-
|
327 |
inputs=None,
|
328 |
-
outputs=output_audio
|
329 |
)
|
330 |
|
|
|
331 |
button_base.click(
|
332 |
process_audio,
|
333 |
inputs=[aud, model, indx],
|
|
|
255 |
|
256 |
|
257 |
def process_audio(audio_files, file_m, file_index):
|
258 |
+
result = run(audio_files, file_m, file_index)
|
259 |
|
260 |
# Create a list of Audio components with filenames as labels
|
261 |
audio_outputs = [
|
|
|
265 |
|
266 |
return result, audio_outputs
|
267 |
|
|
|
|
|
268 |
|
269 |
|
|
|
|
|
|
|
270 |
|
271 |
|
272 |
|
|
|
302 |
variant="primary",
|
303 |
)
|
304 |
|
305 |
+
|
306 |
def output_conf():
|
307 |
+
return gr.File(label="Result", file_count="multiple", interactive=False), gr.Column(visible=False)
|
308 |
|
309 |
|
310 |
def get_gui(theme):
|
|
|
315 |
model = model_conf()
|
316 |
indx = index_conf()
|
317 |
button_base = button_conf()
|
318 |
+
output_file, output_audio = output_conf()
|
|
|
319 |
|
320 |
+
# Reset the audio column when new files are uploaded
|
321 |
aud.change(
|
322 |
+
fn=lambda: (gr.update(visible=False), []),
|
323 |
inputs=None,
|
324 |
+
outputs=[output_audio]
|
325 |
)
|
326 |
|
327 |
+
# Handle the processing and output generation
|
328 |
button_base.click(
|
329 |
process_audio,
|
330 |
inputs=[aud, model, indx],
|