Add progress bar to transcribe script
Browse files- transcribe.py +5 -1
transcribe.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import os
|
2 |
import argparse
|
3 |
from lang_list import LANGUAGE_NAME_TO_CODE, WHISPER_LANGUAGES
|
|
|
4 |
|
5 |
# For pyannote.audio diarize
|
6 |
from pyannote.audio import Model
|
@@ -26,7 +27,7 @@ def transcribe(audio_file, language, device, vocals):
|
|
26 |
# Transcribe audio file
|
27 |
model = "large-v2"
|
28 |
# word_timestamps = True
|
29 |
-
print_progress =
|
30 |
compute_type = "float16"
|
31 |
fp16 = True
|
32 |
batch_size = 8
|
@@ -60,6 +61,8 @@ if __name__ == "__main__":
|
|
60 |
|
61 |
with open(args.input_files, 'r') as f:
|
62 |
inputs = f.read().splitlines()
|
|
|
|
|
63 |
for input in inputs:
|
64 |
input_file, _ = input.split('.')
|
65 |
_, input_name = input_file.split('/')
|
@@ -72,3 +75,4 @@ if __name__ == "__main__":
|
|
72 |
extension = "mp3"
|
73 |
file = f'{vocals_folder}/{input_name}.{extension}'
|
74 |
transcribe(file, language_dict[args.language]["transcriber"], args.device, args.vocals)
|
|
|
|
1 |
import os
|
2 |
import argparse
|
3 |
from lang_list import LANGUAGE_NAME_TO_CODE, WHISPER_LANGUAGES
|
4 |
+
from tqdm import tqdm
|
5 |
|
6 |
# For pyannote.audio diarize
|
7 |
from pyannote.audio import Model
|
|
|
27 |
# Transcribe audio file
|
28 |
model = "large-v2"
|
29 |
# word_timestamps = True
|
30 |
+
print_progress = False
|
31 |
compute_type = "float16"
|
32 |
fp16 = True
|
33 |
batch_size = 8
|
|
|
61 |
|
62 |
with open(args.input_files, 'r') as f:
|
63 |
inputs = f.read().splitlines()
|
64 |
+
|
65 |
+
progress_bar = tqdm(total=len(inputs), desc="Transcribe audio files progress")
|
66 |
for input in inputs:
|
67 |
input_file, _ = input.split('.')
|
68 |
_, input_name = input_file.split('/')
|
|
|
75 |
extension = "mp3"
|
76 |
file = f'{vocals_folder}/{input_name}.{extension}'
|
77 |
transcribe(file, language_dict[args.language]["transcriber"], args.device, args.vocals)
|
78 |
+
progress_bar.update(1)
|