mirror of
https://github.com/openai/whisper.git
synced 2025-03-30 14:28:27 +00:00
Fix output_dir argument when audio file is a path (#45)
This commit is contained in:
parent
c0607e8d22
commit
759e8d47a8
@ -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)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user