mrfakename commited on
Commit
de3a90d
1 Parent(s): 5a9b7ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -110,7 +110,9 @@ def infer(ref_audio_orig, ref_text, gen_text, exp_name, remove_silence):
110
  else:
111
  gr.Info("Using custom reference text...")
112
  audio, sr = torchaudio.load(ref_audio)
113
-
 
 
114
  rms = torch.sqrt(torch.mean(torch.square(audio)))
115
  if rms < target_rms:
116
  audio = audio * target_rms / rms
 
110
  else:
111
  gr.Info("Using custom reference text...")
112
  audio, sr = torchaudio.load(ref_audio)
113
+ # Audio
114
+ if audio.shape[0] > 1:
115
+ audio = torch.mean(audio, dim=0, keepdim=True)
116
  rms = torch.sqrt(torch.mean(torch.square(audio)))
117
  if rms < target_rms:
118
  audio = audio * target_rms / rms