Upload KotobaWhisperPipeline
Browse files- kotoba_whisper.py +2 -2
kotoba_whisper.py
CHANGED
@@ -263,8 +263,8 @@ class KotobaWhisperPipeline(AutomaticSpeechRecognitionPipeline):
|
|
263 |
outputs["chunks"] += new_chunk
|
264 |
outputs["speaker_ids"] = sorted(set([o["speaker_id"] for o in outputs["chunks"]]))
|
265 |
for s in outputs["speaker_ids"]:
|
266 |
-
outputs[f"
|
267 |
-
outputs[f"text/{s}"] = "".join([i["text"] for i in outputs[f"
|
268 |
if postprocess_parameters["add_punctuation"]:
|
269 |
outputs[f"text/{s}"] = self.punctuator.punctuate(outputs[f"text/{s}"])
|
270 |
return outputs
|
|
|
263 |
outputs["chunks"] += new_chunk
|
264 |
outputs["speaker_ids"] = sorted(set([o["speaker_id"] for o in outputs["chunks"]]))
|
265 |
for s in outputs["speaker_ids"]:
|
266 |
+
outputs[f"chunks/{s}"] = sorted([o for o in outputs["chunks"] if o["speaker_id"] == s], key=lambda x: x["timestamp"][0])
|
267 |
+
outputs[f"text/{s}"] = "".join([i["text"] for i in outputs[f"chunks/{s}"]])
|
268 |
if postprocess_parameters["add_punctuation"]:
|
269 |
outputs[f"text/{s}"] = self.punctuator.punctuate(outputs[f"text/{s}"])
|
270 |
return outputs
|