aadnk commited on
Commit
4b4bdeb
2 Parent(s): aa3be84 168184d

Merge branch 'main' of https://huggingface.co/spaces/aadnk/whisper-webui into main

Browse files
src/vad.py CHANGED
@@ -205,11 +205,16 @@ class AbstractTranscription(ABC):
205
 
206
  print("Running whisper from ", format_timestamp(segment_start), " to ", format_timestamp(segment_end), ", duration: ",
207
  segment_duration, "expanded: ", segment_expand_amount, "prompt: ", segment_prompt, "language: ", detected_language)
208
-
 
 
209
  scaled_progress_listener = SubTaskProgressListener(progressListener, base_task_total=progress_total_duration,
210
  sub_task_start=segment_start - progress_start_offset, sub_task_total=segment_duration)
211
  segment_result = whisperCallable.invoke(segment_audio, segment_index, segment_prompt, detected_language, progress_listener=scaled_progress_listener)
212
 
 
 
 
213
  adjusted_segments = self.adjust_timestamp(segment_result["segments"], adjust_seconds=segment_start, max_source_time=segment_duration)
214
 
215
  # Propagate expand amount to the segments
 
205
 
206
  print("Running whisper from ", format_timestamp(segment_start), " to ", format_timestamp(segment_end), ", duration: ",
207
  segment_duration, "expanded: ", segment_expand_amount, "prompt: ", segment_prompt, "language: ", detected_language)
208
+
209
+ perf_start_time = time.perf_counter()
210
+
211
  scaled_progress_listener = SubTaskProgressListener(progressListener, base_task_total=progress_total_duration,
212
  sub_task_start=segment_start - progress_start_offset, sub_task_total=segment_duration)
213
  segment_result = whisperCallable.invoke(segment_audio, segment_index, segment_prompt, detected_language, progress_listener=scaled_progress_listener)
214
 
215
+ perf_end_time = time.perf_counter()
216
+ print("Whisper took {} seconds".format(perf_end_time - perf_start_time))
217
+
218
  adjusted_segments = self.adjust_timestamp(segment_result["segments"], adjust_seconds=segment_start, max_source_time=segment_duration)
219
 
220
  # Propagate expand amount to the segments
src/whisper/fasterWhisperContainer.py CHANGED
@@ -7,6 +7,7 @@ from src.hooks.progressListener import ProgressListener
7
  from src.languages import get_language_from_name
8
  from src.modelCache import ModelCache
9
  from src.whisper.abstractWhisperContainer import AbstractWhisperCallback, AbstractWhisperContainer
 
10
 
11
  class FasterWhisperContainer(AbstractWhisperContainer):
12
  def __init__(self, model_name: str, device: str = None, compute_type: str = "float16",
@@ -138,7 +139,8 @@ class FasterWhisperCallback(AbstractWhisperCallback):
138
  if progress_listener is not None:
139
  progress_listener.on_progress(segment.end, info.duration)
140
  if verbose:
141
- print(segment.text)
 
142
 
143
  text = " ".join([segment.text for segment in segments])
144
 
 
7
  from src.languages import get_language_from_name
8
  from src.modelCache import ModelCache
9
  from src.whisper.abstractWhisperContainer import AbstractWhisperCallback, AbstractWhisperContainer
10
+ from src.utils import format_timestamp
11
 
12
  class FasterWhisperContainer(AbstractWhisperContainer):
13
  def __init__(self, model_name: str, device: str = None, compute_type: str = "float16",
 
139
  if progress_listener is not None:
140
  progress_listener.on_progress(segment.end, info.duration)
141
  if verbose:
142
+ print("[{}->{}] {}".format(format_timestamp(segment.start, True), format_timestamp(segment.end, True),
143
+ segment.text))
144
 
145
  text = " ".join([segment.text for segment in segments])
146