From b418c2004e843752cd034f226907460b8b52b952 Mon Sep 17 00:00:00 2001 From: Shashank S Date: Sat, 31 Aug 2024 19:10:19 +0530 Subject: [PATCH] #2985 Added Progress bars to transcribe.py --- requirements_eval_tflite.txt | 2 ++ transcribe.py | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/requirements_eval_tflite.txt b/requirements_eval_tflite.txt index 00a066e4f8..58c1d600fd 100644 --- a/requirements_eval_tflite.txt +++ b/requirements_eval_tflite.txt @@ -6,3 +6,5 @@ progressbar2==3.47.0 python-utils==2.3.0 six==1.13.0 pandas==0.25.3 +tqdm +mutliprocessing \ No newline at end of file diff --git a/transcribe.py b/transcribe.py index 665921a249..023b4b5edf 100755 --- a/transcribe.py +++ b/transcribe.py @@ -12,6 +12,8 @@ import logging logging.getLogger('sox').setLevel(logging.ERROR) import glob +from tqdm import tqdm +from _multiprocessing import Process from deepspeech_training.util.audio import AudioFile from deepspeech_training.util.config import Config, initialize_globals @@ -73,14 +75,14 @@ def transcribe_file(audio_path, tlog_path): def transcribe_many(src_paths,dst_paths): - pbar = create_progressbar(prefix='Transcribing files | ', max_value=len(src_paths)).start() + pbar = tqdm(total=len(src_paths), desc='Transcribing files', unit='file') for i in range(len(src_paths)): p = Process(target=transcribe_file, args=(src_paths[i], dst_paths[i])) p.start() p.join() - log_progress('Transcribed file {} of {} from "{}" to "{}"'.format(i + 1, len(src_paths), src_paths[i], dst_paths[i])) - pbar.update(i) - pbar.finish() + log_progress(f'Transcribed file {i + 1} of {len(src_paths)} from "{src_paths[i]}" to "{dst_paths[i]}"') + pbar.update(1) + pbar.close() def transcribe_one(src_path, dst_path):