Nekochu commited on
Commit
53f6566
·
1 Parent(s): 35fbf3e

skip bare librosa sidecar, let preprocessing faf analysis handle caption fallback

Browse files
Files changed (1) hide show
  1. app.py +2 -11
app.py CHANGED
@@ -673,7 +673,7 @@ def gradio_main():
673
  )
674
  if not caption_data:
675
  use_understand = False
676
- _log(f" {audio_fname}: GGUF LM too slow, switching to librosa for remaining files")
677
  if caption_data:
678
  bpm_s = caption_data.get("bpm", "?")
679
  key_s = caption_data.get("keyscale", caption_data.get("key", "?"))
@@ -681,16 +681,7 @@ def gradio_main():
681
  with open(sidecar_json, "w") as cj:
682
  json.dump(caption_data, cj)
683
  else:
684
- try:
685
- y_cap, sr_cap = _lr.load(full_path, sr=None, mono=True)
686
- tempo_arr, _ = _lr.beat.beat_track(y=y_cap, sr=sr_cap)
687
- bpm_val = int(round(float(tempo_arr.item() if hasattr(tempo_arr, 'item') else tempo_arr)))
688
- fallback = {"caption": "", "bpm": bpm_val, "key": "", "signature": "", "lyrics": ""}
689
- with open(sidecar_json, "w") as cj:
690
- json.dump(fallback, cj)
691
- _log(f" {audio_fname}: librosa BPM={bpm_val}")
692
- except Exception as cap_exc:
693
- _log(f" {audio_fname}: caption failed: {cap_exc}")
694
  yield _log_text(), gr.Button(visible=False), gr.Button(visible=True), gr.File()
695
 
696
  if _training_cancel.is_set():
 
673
  )
674
  if not caption_data:
675
  use_understand = False
676
+ _log(f" {audio_fname}: GGUF LM too slow, skipping (preprocessing will analyze)")
677
  if caption_data:
678
  bpm_s = caption_data.get("bpm", "?")
679
  key_s = caption_data.get("keyscale", caption_data.get("key", "?"))
 
681
  with open(sidecar_json, "w") as cj:
682
  json.dump(caption_data, cj)
683
  else:
684
+ _log(f" {audio_fname}: will be analyzed in preprocessing (BPM + key + caption)")
 
 
 
 
 
 
 
 
 
685
  yield _log_text(), gr.Button(visible=False), gr.Button(visible=True), gr.File()
686
 
687
  if _training_cancel.is_set():