Automatic Speech Recognition
WhisperKit
Core ML
Portuguese
Spanish
English
macos
apple-silicon
swift
live-captions
subtitles
speech-recognition
machine-translation
on-device
local-first
ollama
Instructions to use Veronyka/livecaption with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- WhisperKit
How to use Veronyka/livecaption with WhisperKit:
# Install CLI with Homebrew on macOS device brew install whisperkit-cli # View all available inference options whisperkit-cli transcribe --help # Download and run inference using whisper base model whisperkit-cli transcribe --audio-path /path/to/audio.mp3 # Or use your preferred model variant whisperkit-cli transcribe --model "large-v3" --model-prefix "distil" --audio-path /path/to/audio.mp3 --verbose
- Notebooks
- Google Colab
- Kaggle
Download scripts/test_mt.py from Veronyka/livecaption: direct link, hf CLI and curl.
- Browser
- Download file 1.24 kB
-
https://huggingface.co/Veronyka/livecaption/resolve/main/scripts/test_mt.py
- Command line
-
hf download hf://Veronyka/livecaption/scripts/test_mt.py
-
curl -L -o test_mt.py https://huggingface.co/Veronyka/livecaption/resolve/main/scripts/test_mt.py
1.24 kB
| import json, time, urllib.request, sys | |
| URL = "http://localhost:11434/api/chat" | |
| MODEL = sys.argv[1] if len(sys.argv) > 1 else "hymt2-1.8b" | |
| FRASES = [ | |
| "Bom dia a todos, vamos começar a live de hoje.", | |
| "A gente vai falar sobre inteligência artificial e soberania de dados.", | |
| "Se vocês estiverem me ouvindo, mandem um oi no chat.", | |
| "O projeto roda no meu computador, sem depender de nenhuma empresa grande.", | |
| "Isso não funcionou da outra vez, então eu resolvi criar o meu próprio sistema.", | |
| "Pessoal, o link da pesquisa está na descrição, não esqueçam de responder.", | |
| ] | |
| def traduz(t): | |
| body = {"model": MODEL, "stream": False, "keep_alive": "30m", | |
| "messages": [{"role": "user", "content": | |
| f"Translate the following segment into Spanish, without additional explanation.\n\n{t}"}]} | |
| r = urllib.request.Request(URL, json.dumps(body).encode(), {"Content-Type": "application/json"}) | |
| t0 = time.perf_counter() | |
| out = json.load(urllib.request.urlopen(r, timeout=120))["message"]["content"].strip() | |
| return out, time.perf_counter() - t0 | |
| for i, f in enumerate(FRASES): | |
| out, dt = traduz(f) | |
| print(f"[{dt:5.2f}s]{' (frio)' if i == 0 else ''} {f}\n -> {out}") | |