fffiloni commited on
Commit
f814738
·
verified ·
1 Parent(s): 59f6f8d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -91,6 +91,10 @@ def infer_img2img(prompt, audio_path, desired_strength, progress=gr.Progress(tra
91
  # Apply fix only if the spectrogram mean is too low
92
  if spec_mean_before < -5.0:
93
  print(f"⚠️ Spectrogram too low (Mean: {spec_mean_before}).")
 
 
 
 
94
  else:
95
  print(f"✅ Spectrogram looks normal (Mean: {spec_mean_before}). No boost needed.")
96
 
 
91
  # Apply fix only if the spectrogram mean is too low
92
  if spec_mean_before < -5.0:
93
  print(f"⚠️ Spectrogram too low (Mean: {spec_mean_before}).")
94
+ def pitch_shift_spectrogram(spec, sr=16000, n_steps=4):
95
+ spec = librosa.effects.pitch_shift(spec, sr, n_steps=n_steps)
96
+ return spec
97
+ spec = pitch_shift_spectrogram(spec, sr=16000, n_steps=4)
98
  else:
99
  print(f"✅ Spectrogram looks normal (Mean: {spec_mean_before}). No boost needed.")
100