camparchimedes commited on
Commit
9bee7bc
·
verified ·
1 Parent(s): e1d8262

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -69,18 +69,18 @@ pipe = pipeline("automatic-speech-recognition", model="NbAiLab/nb-whisper-large"
69
  @spaces.GPU()
70
  def transcribe_audio(audio_file, batch_size=16, sample_rate =16000):
71
  # --audio file to tensor
72
- waveform = waveform.numpy(audio_file)
73
- samples = samples.numpy(audio_file)
74
- waveform, samples = torchaudio.load(waveform, samples)
75
-
76
  if waveform.ndim > 1:
77
  waveform = waveform[0, :]
78
 
 
 
79
  start_time = time.time()
80
 
81
  # --pipe it
82
  with torch.no_grad():
83
- outputs = pipe(waveform, samples, sampling_rate=sample_rate, batch_size=batch_size, return_timestamps=False)
84
 
85
  end_time = time.time()
86
 
 
69
  @spaces.GPU()
70
  def transcribe_audio(audio_file, batch_size=16, sample_rate =16000):
71
  # --audio file to tensor
72
+ waveform, sample_rate = torchaudio.load(audio_file)
73
+
 
 
74
  if waveform.ndim > 1:
75
  waveform = waveform[0, :]
76
 
77
+ waveform = waveform.numpy()
78
+
79
  start_time = time.time()
80
 
81
  # --pipe it
82
  with torch.no_grad():
83
+ outputs = pipe(waveform, sampling_rate=sample_rate, batch_size=batch_size, return_timestamps=False)
84
 
85
  end_time = time.time()
86