Skip to content

✨FEATURE: Add emotion timeline output to Sentiment API #19

Description

@Aarchi-07

Context

Related: sentiment-analysis-api#14 | RUXAILAB#1227

Issue #14 on sentiment-analysis-api requests an emotion timeline using the labels Angry, Disgusted, Fearful, Happy, Neutral, Sad, Surprised. After investigation, these labels are actually produced by this repo (facial-sentiment-analysis-api) via POST /process_video, not the audio sentiment API (which returns POS/NEG/NEU).

Current Behavior

The API returns only an overall average:

{
  "emotions": {
    "Angry": 15.38,
    "Disgusted": 7.69,
    "Fearful": 0.0,
    "Happy": 0.0,
    "Neutral": 53.85,
    "Sad": 23.08,
    "Surprised": 0.0
  }
}

Proposed Behavior

In addition to the average, return a time-based timeline array:

{
  "emotions": { ... },
  "timeline": [
    { "id": 1, "starting_time": "00:00", "ending_time": "00:10", "emotion": "SURPRISED", "value": 54 },
    { "id": 2, "starting_time": "00:10", "ending_time": "00:20", "emotion": "NEUTRAL", "value": 62 }
  ]
}

Requirements

  • Configurable time intervals (e.g. 5s, 10s)
  • Dominant emotion per interval with confidence value
  • Backward compatible (emotions field still returned)

This format matches what the frontend (RUXAILAB#1227) expects to render the emotion timeline visualization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions