bugfix
This commit is contained in:
parent
d88483d341
commit
ee1f718152
17
fw/fw.py
17
fw/fw.py
@ -40,22 +40,17 @@ class MyLongTask(LongTasks):
|
|||||||
return await f(model, fpath)
|
return await f(model, fpath)
|
||||||
|
|
||||||
def transcribe(self, model, fpath):
|
def transcribe(self, model, fpath):
|
||||||
segments, info = model.transcribe(fpath, beam_size=5)
|
segments, info = model.transcribe(fpath, beam_size=5, word_timestamps=True)
|
||||||
segments = list(segments)
|
segments = list(segments)
|
||||||
debug(f'{segments=}')
|
debug(f'{segments=}')
|
||||||
words = []
|
|
||||||
for s in segments:
|
|
||||||
if s.words:
|
|
||||||
words.append([[word.start, word.end, word.word] for word in s.words])
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'language': info.language,
|
'language': info.language,
|
||||||
'language_probability': info.language_probability,
|
'language_probability': info.language_probability,
|
||||||
'content': ' '.join([s.text for s in segments]),
|
'content': ' '.join([s.text for s in segments]),
|
||||||
'words': words,
|
'segments': [[s.start,
|
||||||
'segments': [[segment.start,
|
s.end,
|
||||||
segment.end,
|
s.text,
|
||||||
segment.text
|
[[w.start, w.end, w.word] for w in s.words]
|
||||||
] for segment in segments]
|
] for s in segments]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user