mirror of
https://github.com/openai/whisper.git
synced 2025-03-30 14:28:27 +00:00
Use UTF-8 encoding to save the txt and vtt files (#37)
Explicitly set the text encoding to UTF-8 in order to avoid UnicodeEncodeErrors Co-authored-by: Jong Wook Kim <jongwook@nyu.edu>
This commit is contained in:
parent
759e8d47a8
commit
c85eaaae29
@ -289,11 +289,11 @@ def cli():
|
||||
audio_basename = os.path.basename(audio_path)
|
||||
|
||||
# save TXT
|
||||
with open(os.path.join(output_dir, audio_basename + ".txt"), "w") as txt:
|
||||
with open(os.path.join(output_dir, audio_basename + ".txt"), "w", encoding="utf-8") as txt:
|
||||
print(result["text"], file=txt)
|
||||
|
||||
# save VTT
|
||||
with open(os.path.join(output_dir, audio_basename + ".vtt"), "w") as vtt:
|
||||
with open(os.path.join(output_dir, audio_basename + ".vtt"), "w", encoding="utf-8") as vtt:
|
||||
write_vtt(result["segments"], file=vtt)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user