on1onmangoes commited on
Commit
39fde0b
·
1 Parent(s): 0256fc1

Added number of speakers

Browse files
Files changed (1) hide show
  1. app.py +15 -8
app.py CHANGED
@@ -29,17 +29,24 @@ if torch.cuda.is_available():
29
  import gradio as gr
30
 
31
 
32
- def transcribe(audio_path):
33
- # Run diarization while we wait for Whisper JAX
 
 
 
 
 
 
 
 
 
 
 
 
34
  diarization = diarization_pipeline(audio_path)
35
- #segments = diarization.for_json()["content"]
36
- # Segments = diarization.for_json()["content"]
37
- # Segments = str(diarization)
38
- transcription = "SAML Output"
39
  return diarization
40
 
41
-
42
-
43
  title = "SAML Speaker Diarization ⚡️ "
44
 
45
  description = """Combine the speed of Whisper JAX with pyannote speaker diarization to transcribe meetings in super fast time. Demo uses Whisper JAX as an [endpoint](https://twitter.com/sanchitgandhi99/status/1656665496463495168) and pyannote speaker diarization running locally. The Whisper JAX endpoint is run asynchronously, meaning speaker diarization is run in parallel to the speech transcription. The diarized timestamps are aligned with the Whisper output to give the final speaker-segmented transcription.
 
29
  import gradio as gr
30
 
31
 
32
+ # def transcribe(audio_path):
33
+ # # Run diarization while we wait for Whisper JAX
34
+ # diarization = diarization_pipeline(audio_path)
35
+ # #segments = diarization.for_json()["content"]
36
+ # # Segments = diarization.for_json()["content"]
37
+ # # Segments = str(diarization)
38
+ # transcription = "SAML Output"
39
+ # return diarization
40
+
41
+ def transcribe(audio_path, num_speakers=2):
42
+ # Configure the pipeline to use the provided number of speakers
43
+ diarization_pipeline.n_speakers = num_speakers
44
+
45
+ # Run diarization
46
  diarization = diarization_pipeline(audio_path)
47
+
 
 
 
48
  return diarization
49
 
 
 
50
  title = "SAML Speaker Diarization ⚡️ "
51
 
52
  description = """Combine the speed of Whisper JAX with pyannote speaker diarization to transcribe meetings in super fast time. Demo uses Whisper JAX as an [endpoint](https://twitter.com/sanchitgandhi99/status/1656665496463495168) and pyannote speaker diarization running locally. The Whisper JAX endpoint is run asynchronously, meaning speaker diarization is run in parallel to the speech transcription. The diarized timestamps are aligned with the Whisper output to give the final speaker-segmented transcription.