← All examples inferis-ml

Sentiment Analysis

Classify text as positive or negative with a confidence score. Uses DistilBERT fine-tuned on SST-2 — a fast, accurate sentiment classifier. Model runs in a Web Worker; first run downloads ~70 MB.

const model = await pool.load('text-classification', {
  model: 'Xenova/distilbert-base-uncased-finetuned-sst-2-english',
});
const result = await model.run(text);
// [{ label: 'POSITIVE', score: 0.9998 }]
Loading model
Initializing…
Running in Web Worker UI stays responsive