Spaces:
Build error
Build error
Update app.py
Browse files
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 =
|
73 |
-
|
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,
|
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 |
|