asahi417 commited on
Commit
aa56a4f
1 Parent(s): 9d62abd

Upload KotobaWhisperPipeline

Browse files
Files changed (1) hide show
  1. 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"chunk/{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"chunk/{s}"]])
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