SpeakerScope.ai

Emotion Recognition

Predict the emotion expressed in an audio sample


1. Submit job

Endpoint

POSThttps://speakerscope.ai/api/emotion

Fields

FieldTypeDescription
audio_urlstringURL of the audio file

Example

import requests

response = requests.post(
    "https://speakerscope.ai/api/emotion",
    auth=("<API_KEY>", "<API_SECRET>"),
    json={
        "audio_url": "<AUDIO_URL>",
    },
)

print(response.json())

Response

FieldTypeDescription
job_idstrJob identifier used to poll for the result
{
  "job_id": "cca90f61-c3f4-496b-a33c-6d77a4ce92bf"
}

2. Get results

Endpoint

GEThttps://speakerscope.ai/api/status/{job_id}

Example

import requests

response = requests.get(
    "https://speakerscope.ai/api/status/<JOB_ID>",
    auth=("<API_KEY>", "<API_SECRET>"),
)

print(response.json())

Response

Status

FieldTypeDescription
statusstr"pending", "completed", or "failed"
progressstr (optional)Progress description (when "pending")
errorstr (optional)Error message (when "failed")

Result

FieldTypeDescription
predictionstrPredicted emotion ("neutral", "joy", "sad", "fear", "anger") (when "completed")
probabilitiesdict[str, float]Maps emotion labels to their confidence scores, sorted in descending order (when "completed")

Pending

{
  "status": "pending",
  "progress": "Predicting..."
}

Completed

{
  "status": "completed",
  "prediction": "joy",
  "probabilities": {
    "joy": 0.82,
    "neutral": 0.10,
    "sad": 0.04,
    "anger": 0.03,
    "fear": 0.01
  }
}