From 91d56d23c198cb68fe4f9c9f5c19c70c4a5f1c15 Mon Sep 17 00:00:00 2001 From: Jong Wook Kim Date: Fri, 20 Jan 2023 00:54:05 -0800 Subject: [PATCH] use stdout for printing transcription progress (#867) --- whisper/transcribe.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/whisper/transcribe.py b/whisper/transcribe.py index a8dc3ebe2..5f160a218 100644 --- a/whisper/transcribe.py +++ b/whisper/transcribe.py @@ -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]