← Examples

Speech to text

Whisper transcribes a recording with word-level timestamps, computed as transformers.js computes them.

whisper-tiny.en


The code

const asr = await pipeline("automatic-speech-recognition", "openai/whisper-tiny.en");
const { text, chunks } = await asr(file, { return_timestamps: "word" });

Full source: site/src/examples/speech.ts