Vishal Patil commited on
Update pipeline.py
Browse files- pipeline.py +3 -0
pipeline.py
CHANGED
|
@@ -50,6 +50,9 @@ class SpeechAnnotationPipeline:
|
|
| 50 |
"m4a":"audio/mp4","flac":"audio/flac","ogg":"audio/ogg"}.get(ext,"audio/wav")
|
| 51 |
params = {"model":"nova-2","diarize":"true","punctuate":"true",
|
| 52 |
"utterances":"true","smart_format":"true"}
|
|
|
|
|
|
|
|
|
|
| 53 |
headers = {"Authorization": f"Token {DEEPGRAM_API_KEY}", "Content-Type": mime}
|
| 54 |
response = httpx.post("https://api.deepgram.com/v1/listen",
|
| 55 |
params=params, headers=headers,
|
|
|
|
| 50 |
"m4a":"audio/mp4","flac":"audio/flac","ogg":"audio/ogg"}.get(ext,"audio/wav")
|
| 51 |
params = {"model":"nova-2","diarize":"true","punctuate":"true",
|
| 52 |
"utterances":"true","smart_format":"true"}
|
| 53 |
+
if num_speakers and num_speakers > 0:
|
| 54 |
+
params["diarize_version"] = "latest"
|
| 55 |
+
params["num_speakers"] = str(num_speakers)
|
| 56 |
headers = {"Authorization": f"Token {DEEPGRAM_API_KEY}", "Content-Type": mime}
|
| 57 |
response = httpx.post("https://api.deepgram.com/v1/listen",
|
| 58 |
params=params, headers=headers,
|