fix: update openapi code to match updated return type

This commit is contained in:
promet99
2024-11-10 20:02:25 +09:00
parent 2de090023c
commit e3dc524783

View File

@@ -192,17 +192,17 @@ class OpenaiApiASR(ASRBase):
o = []
for word in segments.words:
start = word.get("start")
end = word.get("end")
start = word.start
end = word.end
if any(s[0] <= start <= s[1] for s in no_speech_segments):
# print("Skipping word", word.get("word"), "because it's in a no-speech segment")
continue
o.append((start, end, word.get("word")))
o.append((start, end, word.word))
return o
def segments_end_ts(self, res):
return [s["end"] for s in res.words]
return [s.end for s in res.words]
def transcribe(self, audio_data, prompt=None, *args, **kwargs):
# Write the audio data to a buffer