Fix: colab stdout error, so replace with stdout wrapper
This commit is contained in:
@@ -5,6 +5,8 @@ import sys
|
||||
from faster_whisper import WhisperModel
|
||||
from tqdm import tqdm
|
||||
|
||||
from tools.stdout_wrapper import get_stdout
|
||||
|
||||
|
||||
def transcribe(wav_path, initial_prompt=None):
|
||||
segments, _ = model.transcribe(
|
||||
@@ -45,7 +47,7 @@ if __name__ == "__main__":
|
||||
os.rename(output_file, output_file + ".bak")
|
||||
|
||||
with open(output_file, "w", encoding="utf-8") as f:
|
||||
for wav_file in tqdm(wav_files, file=sys.stdout):
|
||||
for wav_file in tqdm(wav_files, file=get_stdout()):
|
||||
file_name = os.path.basename(wav_file)
|
||||
text = transcribe(wav_file, initial_prompt=initial_prompt)
|
||||
f.write(f"{file_name}|{speaker_name}|JP|{text}\n")
|
||||
|
||||
Reference in New Issue
Block a user