demavior commited on
Commit
9dba37d
·
verified ·
1 Parent(s): 27e0d0f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -27,8 +27,10 @@ def transcribe(audio):
27
  resampler = torchaudio.transforms.Resample(orig_freq=sample_rate, new_freq=16000)
28
  audio_tensor = resampler(audio_tensor)
29
 
30
- # Convert back to a NumPy array
31
  audio_np = audio_tensor.cpu().numpy()
 
 
32
 
33
  pipe = pipeline(
34
  "automatic-speech-recognition",
 
27
  resampler = torchaudio.transforms.Resample(orig_freq=sample_rate, new_freq=16000)
28
  audio_tensor = resampler(audio_tensor)
29
 
30
+ # Convert back to a NumPy array and ensure it's in the correct shape
31
  audio_np = audio_tensor.cpu().numpy()
32
+ if audio_np.ndim == 2:
33
+ audio_np = audio_np
34
 
35
  pipe = pipeline(
36
  "automatic-speech-recognition",