Coco-18 commited on
Commit
77b8455
Β·
verified Β·
1 Parent(s): b9d1c73

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -753,14 +753,15 @@ def init_reference_audio():
753
  logger.info(f"βœ… Found reference audio directory: {REFERENCE_AUDIO_DIR}")
754
 
755
  # Log the contents to verify
756
- pattern_dir = os.path.join(REFERENCE_AUDIO_DIR, reference_word)
757
- if not os.path.exists(pattern_dir):
758
- logger.warning(f"⚠️ Cannot write to repository directory: {pattern_dir}")
759
- # Create a temporary directory instead
760
- temp_dir = os.path.join(OUTPUT_DIR, "references", reference_word)
761
- os.makedirs(temp_dir, exist_ok=True)
762
- pattern_dir = temp_dir
763
- logger.info(f"πŸ“ Created temporary reference directory: {pattern_dir}")
 
764
  else:
765
  logger.warning(f"⚠️ Reference audio directory not found: {REFERENCE_AUDIO_DIR}")
766
  except Exception as e:
 
753
  logger.info(f"βœ… Found reference audio directory: {REFERENCE_AUDIO_DIR}")
754
 
755
  # Log the contents to verify
756
+ pattern_dirs = [d for d in os.listdir(REFERENCE_AUDIO_DIR)
757
+ if os.path.isdir(os.path.join(REFERENCE_AUDIO_DIR, d))]
758
+ logger.info(f"πŸ“ Found reference patterns: {pattern_dirs}")
759
+
760
+ # Check each pattern directory for wav files
761
+ for pattern_dir_name in pattern_dirs:
762
+ pattern_path = os.path.join(REFERENCE_AUDIO_DIR, pattern_dir_name)
763
+ wav_files = glob.glob(os.path.join(pattern_path, "*.wav"))
764
+ logger.info(f"πŸ“ Found {len(wav_files)} wav files in {pattern_dir_name}")
765
  else:
766
  logger.warning(f"⚠️ Reference audio directory not found: {REFERENCE_AUDIO_DIR}")
767
  except Exception as e: