Skip to content

Commit

Permalink
Fix output_dir argument when audio file is a path (openai#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
EliEron authored Sep 23, 2022
1 parent c0607e8 commit 759e8d4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions whisper/transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,14 @@ def cli():
**args,
)

audio_basename = os.path.basename(audio_path)

# save TXT
with open(os.path.join(output_dir, audio_path + ".txt"), "w") as txt:
with open(os.path.join(output_dir, audio_basename + ".txt"), "w") as txt:
print(result["text"], file=txt)

# save VTT
with open(os.path.join(output_dir, audio_path + ".vtt"), "w") as vtt:
with open(os.path.join(output_dir, audio_basename + ".vtt"), "w") as vtt:
write_vtt(result["segments"], file=vtt)


Expand Down

0 comments on commit 759e8d4

Please sign in to comment.