Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -57,13 +57,13 @@ def convert_to_wav(audio_file):
|
|
57 |
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
58 |
asr = pipeline("automatic-speech-recognition", "NbAiLabBeta/nb-whisper-large")
|
59 |
|
60 |
-
def transcribe_audio(audio_file, batch_size=
|
61 |
if audio_file.endswith(".m4a"):
|
62 |
audio_file = convert_to_wav(audio_file)
|
63 |
|
64 |
start_time = time.time()
|
65 |
|
66 |
-
outputs = asr(audio_file, chunk_length_s=28, return_timestamps=False, generate_kwargs={'num_beams': 5, 'task': 'transcribe', 'language': 'no'})
|
67 |
text = outputs["text"]
|
68 |
|
69 |
end_time = time.time()
|
|
|
57 |
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
58 |
asr = pipeline("automatic-speech-recognition", "NbAiLabBeta/nb-whisper-large")
|
59 |
|
60 |
+
def transcribe_audio(audio_file, batch_size=4):
|
61 |
if audio_file.endswith(".m4a"):
|
62 |
audio_file = convert_to_wav(audio_file)
|
63 |
|
64 |
start_time = time.time()
|
65 |
|
66 |
+
outputs = asr(audio_file, chunk_length_s=28, batch_size=batch_size, return_timestamps=False, generate_kwargs={'num_beams': 5, 'task': 'transcribe', 'language': 'no'}, skip_special_tokens=True)
|
67 |
text = outputs["text"]
|
68 |
|
69 |
end_time = time.time()
|