Commit 03af55e 1 parent 44e8bf5 commit 03af55e Copy full SHA for 03af55e
File tree 2 files changed +6
-0
lines changed
2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,7 @@ def align(
119
119
return_char_alignments : bool = False ,
120
120
print_progress : bool = False ,
121
121
combined_progress : bool = False ,
122
+ progress_callback = None ,
122
123
) -> AlignedTranscriptionResult :
123
124
"""
124
125
Align phoneme recognition predictions to known transcription.
@@ -147,6 +148,8 @@ def align(
147
148
base_progress = ((sdx + 1 ) / total_segments ) * 100
148
149
percent_complete = (50 + base_progress / 2 ) if combined_progress else base_progress
149
150
print (f"Progress: { percent_complete :.2f} %..." )
151
+ if progress_callback :
152
+ progress_callback (percent_complete )
150
153
151
154
num_leading = len (segment ["text" ]) - len (segment ["text" ].lstrip ())
152
155
num_trailing = len (segment ["text" ]) - len (segment ["text" ].rstrip ())
Original file line number Diff line number Diff line change @@ -195,6 +195,7 @@ def transcribe(
195
195
print_progress = False ,
196
196
combined_progress = False ,
197
197
verbose = False ,
198
+ progress_callback = None ,
198
199
) -> TranscriptionResult :
199
200
if isinstance (audio , str ):
200
201
audio = load_audio (audio )
@@ -258,6 +259,8 @@ def data(audio, segments):
258
259
base_progress = ((idx + 1 ) / total_segments ) * 100
259
260
percent_complete = base_progress / 2 if combined_progress else base_progress
260
261
print (f"Progress: { percent_complete :.2f} %..." )
262
+ if progress_callback :
263
+ progress_callback (percent_complete )
261
264
text = out ['text' ]
262
265
if batch_size in [0 , 1 , None ]:
263
266
text = text [0 ]
You can’t perform that action at this time.
0 commit comments