Skip to content

Commit ebfacbf

Browse files
committed
Merge branch 'main' into fix/speaker-backend-integration
2 parents 922bf8d + dc98c72 commit ebfacbf

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

extras/speaker-recognition/src/simple_speaker_recognition/core/audio_backend.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,20 @@ def diarize(self, path: Path, min_speakers: Optional[int] = None, max_speakers:
7777
kwargs['min_speakers'] = min_speakers
7878
if max_speakers is not None:
7979
kwargs['max_speakers'] = max_speakers
80-
81-
diarization = self.diar(str(path), **kwargs)
82-
logger.info(f"Diarization: {diarization}")
83-
80+
81+
output = self.diar(str(path), **kwargs)
82+
logger.info(f"Diarization output: {output}")
83+
84+
# In pyannote.audio 4.0+, the pipeline returns a DiarizeOutput object
85+
# We need to access .speaker_diarization to get the Annotation object
86+
if hasattr(output, 'speaker_diarization'):
87+
diarization = output.speaker_diarization
88+
logger.info(f"Using speaker_diarization from output (pyannote 4.0+)")
89+
else:
90+
# Fallback for older versions (3.x) that return Annotation directly
91+
diarization = output
92+
logger.info(f"Using output directly as Annotation (pyannote 3.x)")
93+
8494
# Apply PyAnnote's built-in gap filling using support() method with configurable collar
8595
# This fills gaps shorter than collar seconds between segments from same speaker
8696
diarization = diarization.support(collar=collar)

0 commit comments

Comments
 (0)