소스 검색

use stdout for printing transcription progress (#867)

Jong Wook Kim 2 년 전
부모
커밋
12e1089462
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      whisper/transcribe.py

+ 2 - 1
whisper/transcribe.py

@@ -169,7 +169,8 @@ def transcribe(
             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]