Martin Bär
commited on
Commit
·
482bc3b
1
Parent(s):
b85582b
Add check if audio is long
Browse files- multimodality_tools.py +4 -1
multimodality_tools.py
CHANGED
|
@@ -27,7 +27,10 @@ def transcribe_audio(file_id: str) -> str:
|
|
| 27 |
|
| 28 |
asr = pipeline("automatic-speech-recognition", model="openai/whisper-tiny")
|
| 29 |
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
return output["text"].strip()
|
| 33 |
|
|
|
|
| 27 |
|
| 28 |
asr = pipeline("automatic-speech-recognition", model="openai/whisper-tiny")
|
| 29 |
|
| 30 |
+
if (len(audio) / 16000) > 25:
|
| 31 |
+
output = asr(audio, return_timestamps=True)
|
| 32 |
+
else:
|
| 33 |
+
output = asr(audio)
|
| 34 |
|
| 35 |
return output["text"].strip()
|
| 36 |
|