salmanmapkar commited on
Commit
3229d20
1 Parent(s): 0a57587

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -22,7 +22,8 @@ from pyannote.audio import Audio
22
  from pyannote.core import Segment
23
  import wave
24
  import contextlib
25
- from sklearn.cluster import AgglomerativeClustering
 
26
  import numpy as np
27
  import json
28
  from datetime import timedelta
@@ -226,7 +227,7 @@ def Transcribe_V2(num_speakers, speaker_names, audio="temp_audio.wav"):
226
  return embedding_model(waveform[None])
227
 
228
  def add_speaker_labels(segments, embeddings, num_speakers):
229
- clustering = AgglomerativeClustering(num_speakers).fit(embeddings)
230
  labels = clustering.labels_
231
  for i in range(len(segments)):
232
  segments[i]["speaker"] = 'SPEAKER ' + str(labels[i] + 1)
 
22
  from pyannote.core import Segment
23
  import wave
24
  import contextlib
25
+ from sklearn.cluster import SpectralClustering
26
+
27
  import numpy as np
28
  import json
29
  from datetime import timedelta
 
227
  return embedding_model(waveform[None])
228
 
229
  def add_speaker_labels(segments, embeddings, num_speakers):
230
+ clustering = SpectralClustering(num_speakers).fit(embeddings)
231
  labels = clustering.labels_
232
  for i in range(len(segments)):
233
  segments[i]["speaker"] = 'SPEAKER ' + str(labels[i] + 1)