Spaces:
Runtime error
Runtime error
AndrewRWilliams
commited on
Commit
•
39f97dc
1
Parent(s):
062f9b2
use `load_audio()`
Browse files
app.py
CHANGED
@@ -30,7 +30,15 @@ def slugify(value, allow_unicode=False):
|
|
30 |
return re.sub(r'[-\s]+', '-', value).strip('-_')
|
31 |
|
32 |
def transcribe(file):
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
file_path = pathlib.Path(file)
|
36 |
sourceName = file_path.stem[:MAX_FILE_PREFIX_LENGTH] + file_path.suffix
|
|
|
30 |
return re.sub(r'[-\s]+', '-', value).strip('-_')
|
31 |
|
32 |
def transcribe(file):
|
33 |
+
|
34 |
+
try:
|
35 |
+
audio = whisper.load_audio(video_file_path)
|
36 |
+
except Exception as e:
|
37 |
+
raise RuntimeError("Error converting video to audio")
|
38 |
+
|
39 |
+
transcribe_options = dict(beam_size=5, best_of=5, without_timestamps=False
|
40 |
+
|
41 |
+
result = model.transcribe(audio, **transcribe_options)
|
42 |
|
43 |
file_path = pathlib.Path(file)
|
44 |
sourceName = file_path.stem[:MAX_FILE_PREFIX_LENGTH] + file_path.suffix
|