mirror of
https://github.com/zhouxiaoka/autoclip.git
synced 2026-09-03 06:24:14 +08:00
Videos without embedded subtitles (e.g. B站 without AI字幕) need Whisper to generate subtitles, but bundling it would bloat every install. Instead let users install it on demand from Settings → 语音识别, and pick which model. Backend uses faster-whisper (CTranslate2, no PyTorch, ~214MB installed, several times faster than openai-whisper, cross-platform) — chosen over mlx-whisper, which hard-depends on torch (~2-3GB). - whisper_runtime.py (new): pip-install faster-whisper into a user-writable dir (<data>/whisper-runtime) using the bundled Python; add to sys.path; status + coarse progress; uninstall. Never writes into the signed .app bundle. - whisper_model_manager.py: tiny→large-v3 from Systran/faster-whisper-*, background download via huggingface_hub, real status; cache under <data>/whisper-models. - speech_recognizer.py: subtitle generation rewritten from the `whisper` CLI to faster-whisper's WhisperModel API → SRT; availability = runtime installed. - speech_recognition.py API: /whisper/install, /whisper/uninstall, /whisper/runtime-status (+ existing /whisper-models*). - SpeechRecognitionConfig.tsx: was a stub; now a full UI (install button + progress + log, model list with download/delete/status) wired to a new speechApi in services/api.ts. - build_macos_arm.sh: allowlist faster_whisper/ctranslate2/huggingface_hub in the dependency guard (they're installed at runtime, imported lazily). Verified end-to-end: install runtime → download tiny model → transcribe a real video into a valid SRT, all through the API/runtime. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>