How fluxcapacitor2/whisper-asr-webapp works
Project type and purpose
• This is a full-stack web application (“whisper-asr-webapp”) for automatic speech recognition, built as a single Docker container.
• Frontend: Svelte SPA (static HTML/CSS/JS) served from the same FastAPI/Uvicorn server.
• Backend: FastAPI exposes a /transcribe endpoint; invokes ffmpeg and OpenAI’s Whisper locally; returns JSON transcript.
Main components
a. Client / Browser
• UI built with Svelte (components in frontend/src)
• Uploads audio/video files, displays transcripts, allows downloads in various formats.
b. Static Asset Server
• Uvicorn/Starlette serves compiled Svelte build (HTML, CSS, JS) on HTTP GET /.
c. REST API Layer
• FastAPI (server.py) listens on /transcribe POST.
d. Transcription Pipeline (inside backend)
• ffmpeg process: normalizes and converts incoming media.
• Whisper model: loads model from local cache (Docker volume whisper_models), performs ASR.
e. Data store / Cache
• Docker volume mounted at /root/.cache/whisper for model files.
f. Docker Container / Host
• Single container running Uvicorn + FastAPI + static assets + Whisper + ffmpeg.
Relationships and data flow
1. User opens Browser → HTTP GET / → Static assets served.
2. User selects file & settings (model, language) → Browser sends POST /transcribe with file + parameters.
3. FastAPI receives request → pipes file into ffmpeg → ffmpeg outputs a normalized audio stream.
4. Whisper library loads model from local cache → processes stream → generates transcription with optional timestamps.
5. FastAPI packages result into JSON → returns HTTP response to Browser.
6. Browser renders transcript in UI; user may download in TXT, SRT, VTT, TSV, JSON.
Architectural patterns and design principles
• Client-Server (SPA + REST API)
• Single container “micro-mono” deployment (frontend + backend in one).
• Separation of concerns: UI vs. processing pipeline.
• Reuse of external tools (ffmpeg) and models (Whisper) via simple process piping.
Relevant technologies/frameworks
• Frontend: Svelte, Vite, Tailwind CSS
• Backend: FastAPI, Uvicorn, Python 3.11 (pyproject.toml)
• Media processing: ffmpeg CLI, OpenAI Whisper Python package
• Containerization: Dockerfile, run.sh, GitHub Actions (docker.yml)
• Volume management for Whisper model cache