aadnk FlippFuzz commited on
Commit
5dcaadd
1 Parent(s): 751fc8f

Add timestamp to verbose output (#21)

Browse files

- Add timestamp to generated output (5b766a28786398f438626f3d7bfc8738266a038c)


Co-authored-by: FlippFuzz <FlippFuzz@users.noreply.huggingface.co>

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