โ† All models

text-classification ยท text ยท WASM ยท ~82 MB

Emotion โ€” the 7 Ekman feelings, one winner

Where the 28-class GoEmotions model lets many emotions fire at once (multi-label sigmoid), this compact DistilRoBERTa classifier is single-label: it runs a softmax over the seven Ekman emotions โ€” anger, disgust, fear, joy, neutral, sadness, surprise โ€” so the seven scores compete and sum to 1, and exactly one wins. Type below and watch the whole distribution light up the emotion wheel, on-device.

At a glance

Modelonnx-community/emotion-english-distilroberta-base-ONNX
Task / pipelinetext-classification (single-label)
Labels7 Ekman classes โ€” anger, disgust, fear, joy, neutral, sadness, surprise; softmax (scores compete and sum to ~1)
ArchitectureDistilRoBERTa-base (82M params) fine-tuned on 6 diverse emotion datasets (j-hartmann)
Quantizationq8 (8-bit) ONNX
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~82 MB, cached after first load
LicenseUnspecified upstream โ€” research/demo use; base DistilRoBERTa is Apache-2.0
Web APIsWebAssembly, Web Workers โ€” all Baseline widely available

Run it

Type anything. The emotion re-scores automatically (debounced) a moment after you stop typing. One emotion wins โ€” the softmax makes the seven scores compete.

See inside โ€” the emotion wheel

The wheel (a 7-axis radar) is the model's full softmax distribution in one shape: each spoke is one emotion, the polygon reaches out as far as that emotion's probability. Because it's a softmax โ€” not a sigmoid โ€” the seven values compete and sum to 1: push one up and the rest fall. That's the difference from multi-label GoEmotions, where every emotion has its own independent score and several can be high at once.

Why it matters

A single, decisive emotion label is often exactly what a product needs โ€” one route, one tag, one reaction. A small softmax classifier gives you that decision plus its confidence, privately, with no round-trip.

Use cases

Basics

Type a message and watch one emotion win, with the full 7-way distribution and wheel updating live.

Practical

Route a queue of support messages by their dominant Ekman emotion โ€” escalate, empathy, celebrate, standard.

Wild

Paste a poem or song lyric and plot its emotional arc, line by line, as the feeling moves.

Multi-model

Contrast 7-emotion detail against a binary sentiment model on the same text โ€” nuance vs a single axis.

How the API works

Single-label classification is one call; ask for all 7 scores with top_k:

import { pipeline } from "@huggingface/transformers";

const classify = await pipeline(
  "text-classification",
  "onnx-community/emotion-english-distilroberta-base-ONNX",
); // downloads + caches ~82 MB once

const out = await classify("what a wonderful surprise!", { top_k: 7 });
// โ†’ [{ label: "joy", score: 0.86 }, { label: "surprise", score: 0.11 },
//    { label: "neutral", score: 0.01 }, โ€ฆ all 7, and they SUM to ~1 ]

The config uses the default problem_type, so Transformers.js applies a softmax across the 7 classes โ€” that's why exactly one wins and the scores sum to 1. All of it runs in a Web Worker so typing never janks.

References