Skip to content

Commit

Permalink
speaker embeddings, redis writer
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyG228 committed Jan 4, 2024
1 parent 1e1ae2a commit 44a7257
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/diart/sinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,7 @@ def __init__(self, uri: Text, redis_client, patch_collar: float = 0.05):

def on_next(self, value: Union[Tuple, Annotation]):
if isinstance(value, tuple):
if len(value)==3:
prediction, _, centroids = value
else:
prediction, _ = value


prediction, _ = value[:2]
# Process each segment in the prediction
for segment, _, label in prediction.itertracks(yield_label=True):
# Update last centroids for each speaker
Expand All @@ -85,7 +80,8 @@ def on_next(self, value: Union[Tuple, Annotation]):
'speaker_id': label,
}
if len(value)==3:
diarization_data['centroids'] = centroids.tolist()
diarization_data['centroids'] = value[-1].tolist()

self.redis_client.rpush(f'diarization_{self.conversation_id}', json.dumps(diarization_data))

else:
Expand Down

0 comments on commit 44a7257

Please sign in to comment.