Wataru commited on
Commit
9a80b9d
·
1 Parent(s): 7780d65
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -36,8 +36,9 @@ def predict_mos(audio_path: str):
36
  ratings = []
37
  for listner in range(1, 11):
38
  wav, sr = torchaudio.load(audio_path)
39
- if sr not in model.sr2id.keys():
40
- return f"Error: Sample rate {sr} not supported by the model. Supported rates: {list(model.sr2id.keys())}"
 
41
  waves = [wav.view(-1).to(model.device)]
42
  srs = torch.tensor(sr).view(1, -1).to(model.device)
43
  if model.condition_sr:
 
36
  ratings = []
37
  for listner in range(1, 11):
38
  wav, sr = torchaudio.load(audio_path)
39
+ if model.condition_sr:
40
+ if sr not in model.sr2id.keys():
41
+ return f"Error: Sample rate {sr} not supported by the model. Supported rates: {list(model.sr2id.keys())}"
42
  waves = [wav.view(-1).to(model.device)]
43
  srs = torch.tensor(sr).view(1, -1).to(model.device)
44
  if model.condition_sr: