vargha commited on
Commit
8ddd8e7
·
1 Parent(s): 727e6a6

autoplay enabled

Browse files
Files changed (1) hide show
  1. components/dashboard_page.py +7 -5
components/dashboard_page.py CHANGED
@@ -186,7 +186,7 @@ class DashboardPage:
186
  log.error(f"Error fetching progress for user {user_id}: {e}")
187
  return "Annotation Progress: Error" # Added label
188
 
189
- def download_voice_fn(folder_link, filename_to_load, autoplay_on_load=False): # Autoplay here is for the btn_load_voice click
190
  if not filename_to_load:
191
  return None, None, gr.update(value=None, autoplay=False)
192
  try:
@@ -655,14 +655,15 @@ class DashboardPage:
655
  def _apply_multiple_trims_fn(self, original_audio_data, trims_list_sec):
656
  if not original_audio_data:
657
  log.warning("apply_multiple_trims_fn: No original audio data.")
658
- return None, gr.update(value=None, autoplay=False)
659
 
660
  sr, wav_orig = original_audio_data
661
  current_wav = wav_orig.copy() # Start with a copy of the original waveform
662
 
663
  if not trims_list_sec: # No trims to apply
664
- log.info("apply_multiple_trims_fn: No trims in list, returning original audio.")
665
- return (sr, current_wav), gr.update(value=(sr, current_wav), autoplay=False)
 
666
 
667
  log.info(f"Applying {len(trims_list_sec)} trims sequentially. Initial shape: {current_wav.shape}, Initial duration: {len(current_wav)/sr:.3f}s")
668
 
@@ -713,7 +714,8 @@ class DashboardPage:
713
  log.info(f"Trim {i+1}: No effective change for trim {trim_info} on current audio (start_sample >= end_sample after clamping or trim times out of bounds for current audio).")
714
 
715
  log.info(f"Finished sequential trimming. Final shape: {current_wav.shape}, Final duration: {len(current_wav)/sr:.3f}s")
716
- return (sr, current_wav), gr.update(value=(sr, current_wav), autoplay=False)
 
717
 
718
  def _convert_trims_to_df_data(self, trims_list_sec):
719
  if not trims_list_sec:
 
186
  log.error(f"Error fetching progress for user {user_id}: {e}")
187
  return "Annotation Progress: Error" # Added label
188
 
189
+ def download_voice_fn(folder_link, filename_to_load, autoplay_on_load=True): # Autoplay here is for the btn_load_voice click
190
  if not filename_to_load:
191
  return None, None, gr.update(value=None, autoplay=False)
192
  try:
 
655
  def _apply_multiple_trims_fn(self, original_audio_data, trims_list_sec):
656
  if not original_audio_data:
657
  log.warning("apply_multiple_trims_fn: No original audio data.")
658
+ return None, gr.update(value=None, autoplay=False) # Keep False if no audio
659
 
660
  sr, wav_orig = original_audio_data
661
  current_wav = wav_orig.copy() # Start with a copy of the original waveform
662
 
663
  if not trims_list_sec: # No trims to apply
664
+ log.info("apply_multiple_trims_fn: No trims in list, returning original audio with autoplay.")
665
+ # Autoplay is True here as this function is called after audio load
666
+ return (sr, current_wav), gr.update(value=(sr, current_wav), autoplay=True)
667
 
668
  log.info(f"Applying {len(trims_list_sec)} trims sequentially. Initial shape: {current_wav.shape}, Initial duration: {len(current_wav)/sr:.3f}s")
669
 
 
714
  log.info(f"Trim {i+1}: No effective change for trim {trim_info} on current audio (start_sample >= end_sample after clamping or trim times out of bounds for current audio).")
715
 
716
  log.info(f"Finished sequential trimming. Final shape: {current_wav.shape}, Final duration: {len(current_wav)/sr:.3f}s")
717
+ # Autoplay is True here as this function is called after audio load and processing
718
+ return (sr, current_wav), gr.update(value=(sr, current_wav), autoplay=True)
719
 
720
  def _convert_trims_to_df_data(self, trims_list_sec):
721
  if not trims_list_sec: