Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
Auto-speaker-labelling: honor the user's threshold setting instead of a hardcoded 0.70
Murtaza Nasir366208cae234
diff --git a/src/services/speaker_embedding_matcher.py b/src/services/speaker_embedding_matcher.pyindex eab91bcb..9af2b643 100644--- a/src/services/speaker_embedding_matcher.py+++ b/src/services/speaker_embedding_matcher.py@@ -306,23 +306,26 @@ def apply_auto_speaker_labels(recording, user):if not embedding_data or not isinstance(embedding_data, list):continue- # Find matching speakers with base similarity threshold+ # Find matching speakers using the USER'S chosen threshold as the+ # filter. Previously this filtered with the hardcoded 0.70+ # BASE_SIMILARITY_THRESHOLD and only then applied the user's+ # confidence_threshold — which meant 'low' (0.3) and 'medium' (0.6)+ # were both effectively 0.70 (nothing under 0.70 ever reached the+ # second check), so those settings did nothing. Filtering at+ # confidence_threshold directly makes the setting actually take+ # effect: low=0.30, medium=0.60, high=0.80.matches = find_matching_speakers(target_embedding=embedding_data,user_id=user.id,- threshold=BASE_SIMILARITY_THRESHOLD+ threshold=confidence_threshold)if not matches:continue- # Check if the best match exceeds the user's confidence thresholdbest_match = matches[0]best_similarity = best_match['similarity'] / 100.0 # Convert from percentage- if best_similarity < confidence_threshold:- continue-# Check for ambiguity: if top 2 matches are within 5% similarity, skipif len(matches) >= 2:second_similarity = matches[1]['similarity'] / 100.0