Spaces:
Runtime error
Runtime error
Whisper Progress Bar - Display More Information
Browse files- app.py +4 -4
- requirements-fasterWhisper.txt +1 -1
- requirements-whisper.txt +1 -1
- requirements.txt +1 -1
- src/hooks/progressListener.py +1 -1
- src/hooks/subTaskProgressListener.py +2 -2
- src/vadParallel.py +4 -2
- src/whisper/fasterWhisperContainer.py +3 -3
- webui.bat +1 -1
app.py
CHANGED
@@ -387,8 +387,8 @@ class WhisperTranscriber:
|
|
387 |
# From 0 to 1
|
388 |
self.progress(current / total, desc=desc)
|
389 |
|
390 |
-
def on_finished(self):
|
391 |
-
self.progress(1)
|
392 |
|
393 |
return ForwardingProgressListener(progress)
|
394 |
|
@@ -466,13 +466,13 @@ class WhisperTranscriber:
|
|
466 |
if nllb_model.nllb_lang is not None:
|
467 |
segment["text"] = nllb_model.translation(seg_text)
|
468 |
pbar.update(1)
|
469 |
-
segments_progress_listener.on_progress(idx+1, len(segments), "Process segments")
|
470 |
|
471 |
nllb_model.release_vram()
|
472 |
perf_end_time = time.perf_counter()
|
473 |
# Call the finished callback
|
474 |
if segments_progress_listener is not None:
|
475 |
-
segments_progress_listener.on_finished()
|
476 |
|
477 |
print("\n\nprocess segments took {} seconds.\n\n".format(perf_end_time - perf_start_time))
|
478 |
except Exception as e:
|
|
|
387 |
# From 0 to 1
|
388 |
self.progress(current / total, desc=desc)
|
389 |
|
390 |
+
def on_finished(self, desc: str = None):
|
391 |
+
self.progress(1, desc=desc)
|
392 |
|
393 |
return ForwardingProgressListener(progress)
|
394 |
|
|
|
466 |
if nllb_model.nllb_lang is not None:
|
467 |
segment["text"] = nllb_model.translation(seg_text)
|
468 |
pbar.update(1)
|
469 |
+
segments_progress_listener.on_progress(idx+1, len(segments), desc=f"Process segments: {idx}/{len(segments)}")
|
470 |
|
471 |
nllb_model.release_vram()
|
472 |
perf_end_time = time.perf_counter()
|
473 |
# Call the finished callback
|
474 |
if segments_progress_listener is not None:
|
475 |
+
segments_progress_listener.on_finished(desc=f"Process segments: {idx}/{len(segments)}")
|
476 |
|
477 |
print("\n\nprocess segments took {} seconds.\n\n".format(perf_end_time - perf_start_time))
|
478 |
except Exception as e:
|
requirements-fasterWhisper.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
ctranslate2>=3.16.0
|
3 |
faster-whisper
|
4 |
ffmpeg-python==0.2.0
|
5 |
-
gradio==3.
|
6 |
yt-dlp
|
7 |
json5
|
8 |
torch
|
|
|
2 |
ctranslate2>=3.16.0
|
3 |
faster-whisper
|
4 |
ffmpeg-python==0.2.0
|
5 |
+
gradio==3.39.0
|
6 |
yt-dlp
|
7 |
json5
|
8 |
torch
|
requirements-whisper.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
git+https://github.com/openai/whisper.git
|
3 |
transformers
|
4 |
ffmpeg-python==0.2.0
|
5 |
-
gradio==3.
|
6 |
yt-dlp
|
7 |
torchaudio
|
8 |
altair
|
|
|
2 |
git+https://github.com/openai/whisper.git
|
3 |
transformers
|
4 |
ffmpeg-python==0.2.0
|
5 |
+
gradio==3.39.0
|
6 |
yt-dlp
|
7 |
torchaudio
|
8 |
altair
|
requirements.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
ctranslate2>=3.16.0
|
3 |
faster-whisper
|
4 |
ffmpeg-python==0.2.0
|
5 |
-
gradio==3.
|
6 |
yt-dlp
|
7 |
json5
|
8 |
torch
|
|
|
2 |
ctranslate2>=3.16.0
|
3 |
faster-whisper
|
4 |
ffmpeg-python==0.2.0
|
5 |
+
gradio==3.39.0
|
6 |
yt-dlp
|
7 |
json5
|
8 |
torch
|
src/hooks/progressListener.py
CHANGED
@@ -4,5 +4,5 @@ class ProgressListener:
|
|
4 |
def on_progress(self, current: Union[int, float], total: Union[int, float], desc: str = None):
|
5 |
self.total = total
|
6 |
|
7 |
-
def on_finished(self):
|
8 |
pass
|
|
|
4 |
def on_progress(self, current: Union[int, float], total: Union[int, float], desc: str = None):
|
5 |
self.total = total
|
6 |
|
7 |
+
def on_finished(self, desc: str = None):
|
8 |
pass
|
src/hooks/subTaskProgressListener.py
CHANGED
@@ -33,5 +33,5 @@ class SubTaskProgressListener(ProgressListener):
|
|
33 |
sub_task_progress = self.sub_task_start + self.sub_task_total * sub_task_progress_frac
|
34 |
self.base_task_listener.on_progress(sub_task_progress, self.base_task_total, desc=desc)
|
35 |
|
36 |
-
def on_finished(self):
|
37 |
-
self.base_task_listener.on_progress(self.sub_task_start + self.sub_task_total, self.base_task_total)
|
|
|
33 |
sub_task_progress = self.sub_task_start + self.sub_task_total * sub_task_progress_frac
|
34 |
self.base_task_listener.on_progress(sub_task_progress, self.base_task_total, desc=desc)
|
35 |
|
36 |
+
def on_finished(self, desc: str = None):
|
37 |
+
self.base_task_listener.on_progress(self.sub_task_start + self.sub_task_total, self.base_task_total, desc=desc)
|
src/vadParallel.py
CHANGED
@@ -170,6 +170,7 @@ class ParallelTranscription(AbstractTranscription):
|
|
170 |
results_async = pool.starmap_async(self.transcribe, parameters)
|
171 |
total_progress = 0
|
172 |
|
|
|
173 |
while not results_async.ready():
|
174 |
try:
|
175 |
delta = progress_queue.get(timeout=5) # Set a timeout of 5 seconds
|
@@ -178,13 +179,14 @@ class ParallelTranscription(AbstractTranscription):
|
|
178 |
|
179 |
total_progress += delta
|
180 |
if progress_listener is not None:
|
181 |
-
|
|
|
182 |
|
183 |
results = results_async.get()
|
184 |
|
185 |
# Call the finished callback
|
186 |
if progress_listener is not None:
|
187 |
-
progress_listener.on_finished()
|
188 |
|
189 |
for result in results:
|
190 |
# Merge the results
|
|
|
170 |
results_async = pool.starmap_async(self.transcribe, parameters)
|
171 |
total_progress = 0
|
172 |
|
173 |
+
idx=0
|
174 |
while not results_async.ready():
|
175 |
try:
|
176 |
delta = progress_queue.get(timeout=5) # Set a timeout of 5 seconds
|
|
|
179 |
|
180 |
total_progress += delta
|
181 |
if progress_listener is not None:
|
182 |
+
idx+=1
|
183 |
+
progress_listener.on_progress(total_progress, total_duration, desc=f"Transcribe parallel: {idx}, {total_progress:.2f}/{total_duration}")
|
184 |
|
185 |
results = results_async.get()
|
186 |
|
187 |
# Call the finished callback
|
188 |
if progress_listener is not None:
|
189 |
+
progress_listener.on_finished(desc=f"Transcribe parallel: {idx}, {total_progress:.2f}/{total_duration}.")
|
190 |
|
191 |
for result in results:
|
192 |
# Merge the results
|
src/whisper/fasterWhisperContainer.py
CHANGED
@@ -145,12 +145,12 @@ class FasterWhisperCallback(AbstractWhisperCallback):
|
|
145 |
)
|
146 |
|
147 |
segments = []
|
148 |
-
|
149 |
for segment in segments_generator:
|
150 |
segments.append(segment)
|
151 |
|
152 |
if progress_listener is not None:
|
153 |
-
progress_listener.on_progress(segment.end, info.duration, "Transcribe")
|
154 |
if verbose:
|
155 |
print("[{}->{}] {}".format(format_timestamp(segment.start, True), format_timestamp(segment.end, True),
|
156 |
segment.text))
|
@@ -187,7 +187,7 @@ class FasterWhisperCallback(AbstractWhisperCallback):
|
|
187 |
self.prompt_strategy.on_segment_finished(segment_index, prompt, detected_language, result)
|
188 |
|
189 |
if progress_listener is not None:
|
190 |
-
progress_listener.on_finished()
|
191 |
return result
|
192 |
|
193 |
def _split_suppress_tokens(self, suppress_tokens: Union[str, List[int]]):
|
|
|
145 |
)
|
146 |
|
147 |
segments = []
|
148 |
+
|
149 |
for segment in segments_generator:
|
150 |
segments.append(segment)
|
151 |
|
152 |
if progress_listener is not None:
|
153 |
+
progress_listener.on_progress(segment.end, info.duration, desc=f"Transcribe: {segment_index}")
|
154 |
if verbose:
|
155 |
print("[{}->{}] {}".format(format_timestamp(segment.start, True), format_timestamp(segment.end, True),
|
156 |
segment.text))
|
|
|
187 |
self.prompt_strategy.on_segment_finished(segment_index, prompt, detected_language, result)
|
188 |
|
189 |
if progress_listener is not None:
|
190 |
+
progress_listener.on_finished(desc=f"Transcribe: {segment_index}.")
|
191 |
return result
|
192 |
|
193 |
def _split_suppress_tokens(self, suppress_tokens: Union[str, List[int]]):
|
webui.bat
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
@echo off
|
2 |
|
3 |
:: The source of the webui.bat file is stable-diffusion-webui
|
4 |
-
set COMMANDLINE_ARGS=--whisper_implementation faster-whisper --input_audio_max_duration -1 --default_model_name large-v2 --auto_parallel True --output_dir output --vad_max_merge_size 90 --
|
5 |
|
6 |
if not defined PYTHON (set PYTHON=python)
|
7 |
if not defined VENV_DIR (set "VENV_DIR=%~dp0%venv")
|
|
|
1 |
@echo off
|
2 |
|
3 |
:: The source of the webui.bat file is stable-diffusion-webui
|
4 |
+
set COMMANDLINE_ARGS=--whisper_implementation faster-whisper --input_audio_max_duration -1 --default_model_name large-v2 --auto_parallel True --output_dir output --vad_max_merge_size 90 --merge_subtitle_with_sources --autolaunch
|
5 |
|
6 |
if not defined PYTHON (set PYTHON=python)
|
7 |
if not defined VENV_DIR (set "VENV_DIR=%~dp0%venv")
|