anton-l HF staff commited on
Commit
67ee766
·
1 Parent(s): 8449bdb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -55,9 +55,11 @@ cosine_sim = torch.nn.CosineSimilarity(dim=-1)
55
  def similarity_fn(path1, path2):
56
  if not (path1 and path2):
57
  return '<b style="color:red">ERROR: Please record audio for *both* speakers!</b>'
58
-
59
- wav1, _ = apply_effects_tensor(*torchaudio.load(path1), EFFECTS)
60
- wav2, _ = apply_effects_tensor(*torchaudio.load(path2), EFFECTS)
 
 
61
  print(wav1.shape, wav2.shape)
62
 
63
  input1 = feature_extractor(wav1.squeeze(0), return_tensors="pt", sampling_rate=16000).input_values.to(device)
 
55
  def similarity_fn(path1, path2):
56
  if not (path1 and path2):
57
  return '<b style="color:red">ERROR: Please record audio for *both* speakers!</b>'
58
+
59
+ wav1, sr1 = librosa.load(path1, mono=True)
60
+ wav1, _ = apply_effects_tensor(torch.tensor(wav1).unsqueeze(0), sr1, EFFECTS)
61
+ wav2, sr2 = librosa.load(path2, mono=True)
62
+ wav2, _ = apply_effects_tensor(torch.tensor(wav2).unsqueeze(0), sr2, EFFECTS)
63
  print(wav1.shape, wav2.shape)
64
 
65
  input1 = feature_extractor(wav1.squeeze(0), return_tensors="pt", sampling_rate=16000).input_values.to(device)