Fedir Zadniprovskyi commited on
Commit
e41bc7f
·
1 Parent(s): 4bdd7f2

chore: log file transcription time

Browse files
Files changed (1) hide show
  1. speaches/main.py +6 -0
speaches/main.py CHANGED
@@ -67,14 +67,20 @@ async def transcribe_file(
67
  assert (
68
  model == config.whisper.model
69
  ), "Specifying a model that is different from the default is not supported yet."
 
70
  segments, transcription_info = whisper.transcribe(
71
  file.file,
72
  language=language,
73
  initial_prompt=prompt,
74
  word_timestamps="words" in timestamp_granularities,
75
  temperature=temperature,
 
76
  )
77
  segments = list(segments)
 
 
 
 
78
  if response_format == ResponseFormat.TEXT:
79
  return utils.segments_text(segments)
80
  elif response_format == ResponseFormat.JSON:
 
67
  assert (
68
  model == config.whisper.model
69
  ), "Specifying a model that is different from the default is not supported yet."
70
+ start = time.perf_counter()
71
  segments, transcription_info = whisper.transcribe(
72
  file.file,
73
  language=language,
74
  initial_prompt=prompt,
75
  word_timestamps="words" in timestamp_granularities,
76
  temperature=temperature,
77
+ vad_filter=True,
78
  )
79
  segments = list(segments)
80
+ end = time.perf_counter()
81
+ logger.info(
82
+ f"Transcribed {transcription_info.duration}({transcription_info.duration_after_vad}) in {end - start:.2f} seconds"
83
+ )
84
  if response_format == ResponseFormat.TEXT:
85
  return utils.segments_text(segments)
86
  elif response_format == ResponseFormat.JSON: