Public
Edited
Apr 8
Transformers.js Text to Speech
Transformers.js Sentiment Analysis
Insert cell
Insert cell
viewof text = Inputs.text({submit: false, value: "Quite an impressive demo"})
Insert cell
${sentiment[0].label=== "POSITIVE" ? "✅" : "❌"} ${sentiment[0].score.toFixed(2)}
Insert cell
sentiment = pipeSentiment(text)
Insert cell
pipeSentiment = transformersJS.pipeline(
"sentiment-analysis",
"Xenova/distilbert-base-uncased-finetuned-sst-2-english",
{
device: "webgpu", // use to use the GPU
// dtype: "q4" // use to save bandwidth
}
)
Insert cell
transformersJS = import('https://unpkg.com/@huggingface/transformers@3.4.2/dist/transformers.min.js?module')
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more