Files
Abolfazl Ranjbaran 601fed0766 fix(demo): never hang again — real speed, progress and cancel for the browser Space
Root causes of the eternal 'processing' state:
- worker dropped every command: Chromium 158+ posts dedicated-worker
  messages with an EMPTY event.origin, so the strict origin guard
  rejected them all; now only foreign origins are rejected
- decodeAudioData inside a forced 16 kHz AudioContext can wedge on
  opus/webm in Chromium; decode now runs at the natural rate and is
  resampled offline to 16 kHz with a 45 s watchdog

Speed:
- WebGPU fast path (fp32 encoder + q4 decoder) with automatic WASM/q8
  fallback and a one-time mid-run GPU->CPU retry on driver errors
- windowing moved into the worker (30 s window / 5 s overlap,
  timestamp-midpoint trim) enabling true per-window progress

UX:
- per-window progress + ETA + elapsed timer + stage pills + device badge
- cancel button that terminates the worker (model stays in cache)
- timestamped line-by-line transcript toggle + copy button
- hard caps: 30 min WebGPU / 10 min WASM / 60 MB per file, with clear
  Persian messages — no input can wedge the demo anymore
2026-11-26 08:57:39 +00:00

2.1 KiB

title, emoji, colorFrom, colorTo, sdk, pinned, license, license_name, license_link, short_description
title emoji colorFrom colorTo sdk pinned license license_name license_link short_description
Sokhan سخن 🎤 indigo purple static false other PolyForm Noncommercial 1.0.0 https://github.com/Abolfazlrwm/sokhan/blob/main/LICENSE تبدیل گفتار فارسی به نوشتار — اجرا کامل درون مرورگر

Sokhan — Persian speech-to-text, in your browser

A live demo of Sokhan's speech engine that runs entirely client-side: Whisper (ONNX) executes on the visitor's own machine via transformers.js — nothing is uploaded, no backend, no compute cost. Persian RTL UI, mic recording, file upload and a bundled benchmark sample clip.

Speed and reliability: the demo picks the fastest backend the browser offers — WebGPU (fp32 encoder + q4 decoder) on Chrome/Edge, WASM q8 everywhere else — and owns the 30 s/5 s windowing itself, so it reports per-window progress with an ETA, shows an elapsed timer, enforces a duration cap (30 min on WebGPU, 10 min on WASM) and offers a real cancel button that terminates the worker. Audio is decoded at the context's natural rate and resampled offline to 16 kHz, avoiding a Chromium hang on opus/webm inputs.

Two untuned checkpoints are selectable (base / small) so anyone can hear the difference. The fine-tuned checkpoint (Abol0pati/whisper-small-fa-sokhan, LoRA on 500 Common Voice fa clips, measured WER 79.3% vs 80.5% baseline) is served by the same engine Sokhan runs in production — the app for that lives in space/gradio/ for self-hosting, because HF's 2026 pricing gates hosted Gradio/Docker Spaces behind a PRO subscription and only static Spaces (like this page) remain free. Porting the fine-tune to ONNX for the browser is on the roadmap (docs/ROADMAP.md).

Persian Common Voice is colloquial and noisy — expect real mistakes, from every Whisper size.