KevinGeng commited on
Commit
b27c1ab
1 Parent(s): fa64b53

Update app.py

Browse files

Support multi channels

Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -44,7 +44,7 @@ class ChangeSampleRate(nn.Module):
44
  model = lightning_module.BaselineLightningModule.load_from_checkpoint("epoch=3-step=7459.ckpt").eval()
45
 
46
  def calc_mos(audio_path, ref):
47
- wav, sr = torchaudio.load(audio_path)
48
  osr = 16_000
49
  batch = wav.unsqueeze(0).repeat(10, 1, 1)
50
  csr = ChangeSampleRate(sr, osr)
 
44
  model = lightning_module.BaselineLightningModule.load_from_checkpoint("epoch=3-step=7459.ckpt").eval()
45
 
46
  def calc_mos(audio_path, ref):
47
+ wav, sr = torchaudio.load(audio_path, channels_first=True) # Mono channel
48
  osr = 16_000
49
  batch = wav.unsqueeze(0).repeat(10, 1, 1)
50
  csr = ChangeSampleRate(sr, osr)