How xenova/whisper-web works
Project type and purpose
• This is a client-side, full-frontend web application (“Whisper Web”) for running Whisper ML speech-to-text entirely in the browser. It uses React (TSX), Vite, Tailwind CSS, and Hugging Face’s Transformers.js, with an optional experimental WebGPU branch.
File structure
• Top-level:
• index.html – root HTML file
• package.json & package-lock.json – dependencies & scripts
• Vite/tailwind/postCSS/ESLint/TS config files – build and lint configuration
• Public folder: static assets
• src folder:
• App.tsx + index.tsx – React app entry point
• components/ – UI components (AudioRecorder, AudioPlayer, TranscribeButton, Progress, Transcript, Modal, etc.)
• hooks/ – custom React hooks (useTranscriber for orchestration, useWorker for managing Web Worker)
• utils/ – helper functions for audio handling, constants, blob fixes
• worker.js – Web Worker script that loads the Whisper model via Transformers.js, runs inference
• No backend folders: inference happens entirely client-side.
Extract architectural insights from the README
• Core functionality: record or load audio, then transcribe via Whisper model in-browser.
• Uses Transformers.js for model loading/inference.
• Optional WebGPU acceleration path.
• Web Worker required to avoid blocking UI during heavy ML computation.