anton-l HF staff commited on
Commit
1f0ae0a
1 Parent(s): d745b80

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import gradio as gr
2
  import torch
3
  from torchaudio.sox_effects import apply_effects_file
@@ -54,8 +55,8 @@ def similarity_fn(path1, path2):
54
  if not (path1 and path2):
55
  return '<b style="color:red">ERROR: Please record audio for *both* speakers!</b>'
56
 
57
- wav1, _ = apply_effects_file(path1, EFFECTS, format=path1.split(".")[-1])
58
- wav2, _ = apply_effects_file(path2, EFFECTS, format=path2.split(".")[-1])
59
  print(wav1.shape, wav2.shape)
60
 
61
  input1 = feature_extractor(wav1.squeeze(0), return_tensors="pt", sampling_rate=16000).input_values.to(device)
 
1
+ import os
2
  import gradio as gr
3
  import torch
4
  from torchaudio.sox_effects import apply_effects_file
 
55
  if not (path1 and path2):
56
  return '<b style="color:red">ERROR: Please record audio for *both* speakers!</b>'
57
 
58
+ wav1, _ = apply_effects_file(os.path.abspath(path1), EFFECTS)
59
+ wav2, _ = apply_effects_file(os.path.abspath(path2), EFFECTS)
60
  print(wav1.shape, wav2.shape)
61
 
62
  input1 = feature_extractor(wav1.squeeze(0), return_tensors="pt", sampling_rate=16000).input_values.to(device)