Pipeline code copied into app/; llama.py now uses launcher-local llama.cpp (app/bin) and Qwen GGUF (app/models) instead of LM Studio. install.js fetches ffmpeg, 7zip, llama.cpp CUDA 13, sherpa-onnx diarization models, bge-m3 and Qwen3.6-35B-A3B, then pre-builds the uv script environments. start.js serves the GUI on fixed port 18765 (hardcoded in the browser extension). reset.js keeps app/out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
"""Map diarization labels to names seen in Teams call events."""
|
|
import json
|
|
import db
|
|
|
|
|
|
def run(name):
|
|
p = db.out_dir(name) / "diar_segments.json"
|
|
ev = db.events(name, "active", "caption")
|
|
if not p.exists() or not ev: return
|
|
segs = json.loads(p.read_text(encoding="utf-8"))
|
|
iv = []
|
|
for e in ev:
|
|
if not e["who"]: continue
|
|
a, b = (e["t"], e["t"] + 0.5) if e["kind"] == "active" else (e["t"] - 2, e["t"] + 2)
|
|
iv.append((a, b, e["who"]))
|
|
tot = {}
|
|
for s in segs:
|
|
d = tot.setdefault(s["label"], {})
|
|
for a, b, who in iv:
|
|
o = min(b, s["end"]) - max(a, s["start"])
|
|
if o > 0: d[who] = d.get(who, 0) + o
|
|
for label in {s["label"] for s in segs}:
|
|
d = tot.get(label, {})
|
|
if not d:
|
|
db.set_speaker_map(name, label, "", "auto", 0); continue
|
|
person = max(d, key=d.get); ov = d[person]
|
|
ok = ov >= 5 and ov / sum(d.values()) >= 0.4
|
|
db.set_speaker_map(name, label, person if ok else "", "auto", ov)
|