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
2 people authored and yaomingamd committed Nov 27, 2023
1 parent c3b66a1 commit 844c8d9
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 844c8d9

Please sign in to comment.