Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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",
|