Skip to content

Commit

Permalink
use stdout for printing transcription progress (openai#867)
Browse files Browse the repository at this point in the history
  • Loading branch information
jongwook authored and ilanit1997 committed May 16, 2023
1 parent 5d304e4 commit 91d56d2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion whisper/transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ def add_segment(
line = f"[{format_timestamp(start)} --> {format_timestamp(end)}] {text}\n"
# compared to just `print(line)`, this replaces any character not representable using
# the system default encoding with an '?', avoiding UnicodeEncodeError.
sys.stderr.buffer.write(line.encode(sys.getdefaultencoding(), errors="replace"))
sys.stdout.buffer.write(line.encode(sys.getdefaultencoding(), errors="replace"))
sys.stdout.flush()

# show the progress bar when verbose is False (otherwise the transcribed text will be printed)
num_frames = mel.shape[-1]
Expand Down

0 comments on commit 91d56d2

Please sign in to comment.