From 78ac29629df4a7d2b9a4ffef87d38ed9281dd283 Mon Sep 17 00:00:00 2001 From: Nika Siradze Date: Wed, 10 Jun 2026 17:49:30 +0400 Subject: [PATCH] fix: face analysis crash when transcript has no speaker labels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - face_analysis: guard speakers_by_talk[0] — the split-screen branch is gated on face clusters, not speakers, so an empty speaker list (no diarization) hit IndexError - transcription: import sys so the best-effort 'face analysis failed' handler logs instead of raising NameError and aborting the whole transcription --- backend/services/face_analysis.py | 2 +- backend/services/transcription.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/services/face_analysis.py b/backend/services/face_analysis.py index 8eb6e0b..17fe762 100644 --- a/backend/services/face_analysis.py +++ b/backend/services/face_analysis.py @@ -305,7 +305,7 @@ def _confidence_for(speaker: str, cluster_index: int) -> int: speaker_mappings[top_2[1]] = 1 - speaker_mappings[top_2[0]] # Extra speakers → dominant speaker's cluster - dominant_idx = speaker_mappings.get(speakers_by_talk[0], 0) + dominant_idx = speaker_mappings.get(speakers_by_talk[0], 0) if speakers_by_talk else 0 for sp in speakers_by_talk[2:]: speaker_mappings[sp] = dominant_idx elif len(clusters_list) >= 2 and len(speakers) >= 2: diff --git a/backend/services/transcription.py b/backend/services/transcription.py index 3dde47d..69f7493 100644 --- a/backend/services/transcription.py +++ b/backend/services/transcription.py @@ -9,6 +9,7 @@ import os import subprocess +import sys import tempfile from typing import Optional, Callable