jfforero commited on
Commit
7d6c064
·
verified ·
1 Parent(s): d9af7ad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -4
app.py CHANGED
@@ -346,6 +346,9 @@ def clear_all():
346
  # For chunk duration (reset to 10)
347
  outputs.append(10)
348
 
 
 
 
349
  return outputs
350
 
351
  # Function to load example audio
@@ -483,8 +486,14 @@ with gr.Blocks(title="Affective Virtual Environments - Chunked Processing") as i
483
  # Function to handle example selection
484
  def load_example(example_name):
485
  if not example_name:
486
- return None
487
- return load_example_audio(example_name)
 
 
 
 
 
 
488
 
489
  # Set up the button click
490
  process_btn.click(
@@ -509,14 +518,14 @@ with gr.Blocks(title="Affective Virtual Environments - Chunked Processing") as i
509
  container['sentiment'],
510
  container['image'],
511
  container['music']
512
- ]] + [loading_indicator] + [chunk_duration_input]
513
  )
514
 
515
  # Set up the example loading button
516
  load_example_btn.click(
517
  fn=load_example,
518
  inputs=[example_selector],
519
- outputs=[audio_input]
520
  )
521
 
522
  interface.launch()
 
346
  # For chunk duration (reset to 10)
347
  outputs.append(10)
348
 
349
+ # For example selector (reset to None)
350
+ outputs.append(None)
351
+
352
  return outputs
353
 
354
  # Function to load example audio
 
486
  # Function to handle example selection
487
  def load_example(example_name):
488
  if not example_name:
489
+ return None, None # Return None for both audio and example selector
490
+
491
+ # Get the path to the example audio file
492
+ example_path = load_example_audio(example_name)
493
+
494
+ # Return the example path to update the audio component
495
+ # The waveform will be automatically displayed by Gradio's Audio component
496
+ return example_path, example_name
497
 
498
  # Set up the button click
499
  process_btn.click(
 
518
  container['sentiment'],
519
  container['image'],
520
  container['music']
521
+ ]] + [loading_indicator] + [chunk_duration_input] + [example_selector]
522
  )
523
 
524
  # Set up the example loading button
525
  load_example_btn.click(
526
  fn=load_example,
527
  inputs=[example_selector],
528
+ outputs=[audio_input, example_selector]
529
  )
530
 
531
  interface.launch()