Skip to content

Commit

Permalink
Fix exception when an audio file with no speech is provided (openai#1396
Browse files Browse the repository at this point in the history
)

Co-authored-by: Jong Wook Kim <[email protected]>
  • Loading branch information
jordimas and jongwook committed Oct 10, 2023
1 parent 0a60fca commit b38a1f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion whisper/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def iterate_subtitles():
if len(subtitle) > 0:
yield subtitle

if "words" in result["segments"][0]:
if len(result["segments"]) > 0 and "words" in result["segments"][0]:
for subtitle in iterate_subtitles():
subtitle_start = self.format_timestamp(subtitle[0]["start"])
subtitle_end = self.format_timestamp(subtitle[-1]["end"])
Expand Down

0 comments on commit b38a1f2

Please sign in to comment.