Mbonea commited on
Commit
6278580
·
1 Parent(s): aeb3fbb

word_timestamps=True

Browse files
App/Transcription/Utils/audio_transcription.py CHANGED
@@ -15,7 +15,9 @@ def transcribe_file(state, file_path, model_size="tiny"):
15
  meta=metadata.dict(),
16
  )
17
  model = WhisperModel(model_size, device="cpu", compute_type="int8")
18
- segments, info = model.transcribe(file_path, beam_size=5, vad_filter=True)
 
 
19
 
20
  total_duration = round(info.duration, 2)
21
  metadata.logs = (
@@ -39,7 +41,6 @@ def transcribe_file(state, file_path, model_size="tiny"):
39
  "end": word.end,
40
  "text": word.text,
41
  }
42
- # time_stamp = "[%.2fs -> %.2fs]" % (segment.start, segment.end)
43
  result.append(temp)
44
  metadata.logs = "Transcribing.."
45
  metadata.percentage = f"{((segment.end / total_duration)*100)}"
 
15
  meta=metadata.dict(),
16
  )
17
  model = WhisperModel(model_size, device="cpu", compute_type="int8")
18
+ segments, info = model.transcribe(
19
+ file_path, beam_size=5, vad_filter=True, word_timestamps=True
20
+ )
21
 
22
  total_duration = round(info.duration, 2)
23
  metadata.logs = (
 
41
  "end": word.end,
42
  "text": word.text,
43
  }
 
44
  result.append(temp)
45
  metadata.logs = "Transcribing.."
46
  metadata.percentage = f"{((segment.end / total_duration)*100)}"