Diarization not working #584
-
Which Deepgram product are you using?Deepgram API Detailsusing If you are making a request to the Deepgram API, what is the full Deepgram URL you are making a request to?https://api.deepgram.com/v1/listen If you are making a request to the Deepgram API and have a request ID, please paste it below:dd98d562-06b8-4323-87e4-0cf504bb1235 If possible, please attach your code or paste it into the text box.import os
import logging
from datetime import datetime, timedelta
import requests
import json
# Set your Deepgram API key here
DEEPGRAM_API_KEY = "<>"
AUDIO_FILE = "/my-audio.wav"
def main():
try:
# STEP 1: Prepare the headers with the API key
headers = {
"Authorization": f"Token {DEEPGRAM_API_KEY}",
"Content-Type": "audio/wav",
}
# STEP 2: Read the audio file
with open(AUDIO_FILE, "rb") as file:
audio_data = file.read()
# STEP 3: Prepare the request payload
payload = audio_data
# STEP 4: Prepare the transcription options
params = {
"diarize": "true",
"model": "nova-2"
}
# STEP 5: Make the API request
before = datetime.now()
response = requests.post("https://api.deepgram.com/v1/listen", headers=headers, params=params, data=payload)
after = datetime.now()
# Parse the response as JSON
response_json = response.json()
# Print the JSON response
print(response_json)
print("")
difference = after - before
print(f"time: {difference.seconds}")
# Print the JSON response in a pretty format
print(json.dumps(response_json, indent=4))
print("")
except Exception as e:
print(f"Exception: {e}")
if __name__ == "__main__":
main() If possible, please attach an example audio file to reproduce the issue.No response |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
Thanks for asking your question about Deepgram! If you didn't already include it in your post, please be sure to add as much detail as possible so we can assist you efficiently, such as:
|
Beta Was this translation helpful? Give feedback.
-
@jgeddes-receptiviti 👋 something you can do to troubleshoot is trying to run this same request in our API Playground and see if the results differ Are you using our Python SDK by any chance? Also you said the file was fairly large, so I'm curious if you were able to try to split the file up if that results in a better outcome. |
Beta Was this translation helpful? Give feedback.
-
I've tried Deepgram too. First of all, it's speed is mind blowing. But diarization always returns a speaker 0. So I am hoping to try again in 2025 and see two speakers✌️ Also tried in Assembly AI's playground. It worked but wasn't accurate enough. I also tried Gemini 1.5 Pro. Produced by far the best results but it hallucinates too much of things not said 🤣 |
Beta Was this translation helpful? Give feedback.
-
My issue was that the speaker field wasn't showing up at all with nova-2 streaming. When I switched to nova-2-meeting I started getting speaker results with different id's. |
Beta Was this translation helpful? Give feedback.
Change the model and try again if you're using general nova-2 model try with other models like nova-2-phonecall,nova-2-medical,nova-2-meeting. https://developers.deepgram.com/docs/models-languages-overview