CPU-only online speaker labelling for caption windows (CAPTION_DIARIZATION=1): pyannote segmentation-3.0 finds local turns, a TitaNet-small voiceprint via sherpa-onnx matches them to per-room speakers numbered in arrival order. /transcribe?speakers=1 returns committed words grouped into segments with a speaker ID and the name assigned for the show. Models are SHA-256 pinned and cached with the Whisper weights; audio and voiceprints are never stored. Rooms gain a persisted cast list and in-memory per-show names through /api/rooms/<id>/speakers. The capture page offers "Identify speakers automatically", publishes one relay caption per speaker turn with label and spk, and shares a speaker-names panel (speaker-names.js) with the editor. Also adds scripts/diarize_eval.py, deploy.py --speakers, and copies rooms.py into the GPU image.
21 lines
867 B
Docker
21 lines
867 B
Docker
FROM nvidia/cuda:12.9.2-cudnn-runtime-ubuntu24.04
|
|
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 HF_HOME=/models HF_HUB_DISABLE_TELEMETRY=1 \
|
|
CAPTION_DEVICE=cuda PATH=/opt/venv/bin:$PATH
|
|
RUN apt-get update && apt-get install -y --no-install-recommends python3 python3-venv libgomp1 \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& python3 -m venv /opt/venv \
|
|
&& useradd --uid 10001 --create-home caption \
|
|
&& mkdir /models && chown caption:caption /models
|
|
WORKDIR /app
|
|
COPY requirements-linux.lock .
|
|
RUN pip install --no-cache-dir -r requirements-linux.lock
|
|
COPY server.py api_compat.py healthcheck.py rooms.py speakers.py ./
|
|
COPY static/ static/
|
|
COPY LICENSE .
|
|
USER 10001:10001
|
|
EXPOSE 8765
|
|
HEALTHCHECK --interval=10s --timeout=5s --start-period=300s --retries=3 \
|
|
CMD python healthcheck.py
|
|
ENTRYPOINT ["python", "server.py"]
|
|
CMD ["--host", "0.0.0.0"]
|