amywork777/lipflow
소개
입술로 사용하는 Wispr Flow입니다. 키를 누른 채 소리 없이 입 모양을 만들면 커서 위치에 글자가 입력됩니다. Mac에서 로컬로 실행됩니다.
기타 프로젝트측정된 스타 증가
- in 24h
- +31
- in 7 days
- +57
- in 15 days
- +61
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalLipflow
Wispr Flow for your lips. Hold a key, silently mouth what you want to say, let go, and the text shows up at your cursor in whatever app you're in. No microphone and no sound, just your webcam.
Everything runs locally on your Mac, Windows PC, or Linux. An optional LLM pass fixes the words lip reading gets wrong.
hold ⌥ (right) ──► webcam ──► face landmarks (live) ──► mouth crops, 25 fps
│
paste at cursor ◄── LLM cleanup ◄── beam search + LM ◄── VSR encoder (Apple GPU)
▲
live preview: greedy CTC every 0.45 s while you talk
Setup
Needs a Mac on macOS 13 or later (macOS 26 for the Liquid Glass look), and about 2 GB of disk. Intel Macs work too, with a few differences.
git clone https://github.com/amywork777/lipflow.git ~/code/lipflow
cd ~/code/lipflow && ./setup.sh # installs uv deps, ~1.2 GB of models, builds /Applications/Lipflow.app
open /Applications/Lipflow.app
The first launch opens setup, which takes about 8 minutes:
- Permissions: Camera, Input Monitoring and Accessibility, each asked once for "Lipflow". The app is a small signed program that loads this checkout in-process, so those permissions belong to Lipflow rather than to Python. If a switch is on in System Settings but setup still shows it off, click Restart Lipflow under Continue.
- Your words: if you use Wispr Flow, it imports your dictation history (read locally, never uploaded) to learn your phrasing and the names you say.
- Practice: you silently mouth 24 sentences (taken from your own history when available).
- Train: it fine-tunes the language model on your phrasing and the lip reader on your face, on this Mac's GPU. Six practice sentences are held out, and the face model is only kept if it reads them better than the stock model. You see the before/after score.
Re-run it any time from the menu → Set up / train on my face…. More practice clips help more.
Everything personal (clips, phrases, trained models) lives in
~/Library/Application Support/Lipflow/. Delete that folder to start over.
To start Lipflow at login: System Settings → General → Login Items → add Lipflow. Logs are in
~/Library/Logs/Lipflow.log. Running from a terminal (uv run lipflow) also works, but then
macOS asks for permissions in the terminal's name.
Intel Macs
Same setup. Differences from Apple Silicon:
- Speed: the encoder runs on the CPU (PyTorch's Apple GPU backend is unreliable on Intel Macs' AMD GPUs), so expect a few seconds from release to text. Training on your face is slower too.
- PyTorch 2.2.2: the last release with Intel Mac builds.
uv syncpicks it for you. - Cleanup: the on-device model needs Apple Silicon. Use Claude, ChatGPT (Codex CLI), or Ollama for better accuracy (see LLM cleanup).
Windows
Needs Windows 10 or 11 (64-bit) and about 3 GB of disk. In PowerShell:
git clone https://github.com/amywork777/lipflow.git $HOME\code\lipflow
cd $HOME\code\lipflow
powershell -ExecutionPolicy Bypass -File setup.ps1 # uv deps, ~1.2 GB of models, Start menu shortcut
Then open Lipflow from the Start menu. It lives in the system tray (the pink mouth by the clock; click ^ if it's hidden). The first launch opens the same setup as on a Mac, minus permissions: your Wispr Flow words, 24 practice sentences, then training on your face.
How it differs from the Mac version:
- Key: hold Right Ctrl (change it in the tray menu → Push-to-talk key: Right Alt / AltGr, Left Alt or Right Shift also work). Double-tap for hands-free and Esc to cancel work the same.
- Camera: if it doesn't come on, turn on Settings → Privacy & security → Camera → Let desktop
apps access your camera. Pick another camera by number in the tray menu. If your camera gives
DirectShow only black frames, Lipflow switches to Media Foundation by itself and remembers that;
to force one, set
LIPFLOW_CAMERA_BACKENDtodshow,msmforany(e.g.setx LIPFLOW_CAMERA_BACKEND msmf, then restart Lipflow). - Speed: without an NVIDIA GPU the lip reader runs on the processor, so expect a second or two
more per sentence than on a Mac (on an M4 Pro the encoder takes 1.7 s on CPU vs 0.16 s on the
GPU), and training on your face takes several times longer. With an NVIDIA card, install the
CUDA build of PyTorch:
uv pip install torch --index-url https://download.pytorch.org/whl/cu126(re-run it afteruv sync, which puts the CPU build back). - Cleanup: the in-process local model is Mac-only (MLX), so use Claude (
setx ANTHROPIC_API_KEY …, then restart Lipflow), the Codex CLI (codex login), or Ollama (ollama pull qwen3:4b). Without one of these, Lipflow uses the offline rules. - Names from context: taken from the window title only (on a Mac it also reads the text around your cursor). Learning from your corrections is Mac-only for now.
- Start with Windows: tray menu → Start with Windows. Your data lives in
%APPDATA%\Lipflow(log:Lipflow.logthere).uv run lipflow doctorchecks the models and camera.
Linux
Needs a 64-bit Linux distro with a webcam, Python 3.11–3.12, and about 3 GB of disk (models + PyTorch).
git clone https://github.com/amywork777/lipflow.git ~/code/lipflow
cd ~/code/lipflow
curl -LsSf https://astral.sh/uv/install.sh | sh # if you don't have uv yet
uv sync
./scripts/download-models.sh # ~1.2 GB of models
uv run lipflow doctor
uv run lipflow # system tray (pink mouth icon)
The first launch runs the same setup as on Windows (import Wispr phrases if present, ~24 practice
sentences, optional training on your face). Personal data lives in
$XDG_DATA_HOME/Lipflow (usually ~/.local/share/Lipflow). Logs: Lipflow.log in that folder.
How it differs from the Mac version:
- Key: hold Right Ctrl by default (tray menu → Push-to-talk key: Right Alt / AltGr, Left Alt, or Right Shift). Double-tap for hands-free; Esc cancels.
- Paste: Wayland needs wl-clipboard and a keystroke
injector: wtype on Hyprland and Sway, direct
/dev/uinputviaevdev(kernel virtual keyboard, works across GNOME, KDE, and wlroots), or ydotool (withydotoold). X11 usesxdotool,/dev/uinput, andxclip.--copy-onlyleaves the text on the clipboard.Note on
/dev/uinput: To allow pasting via/dev/uinputwithout root, ensure your user has access (e.g. create/etc/udev/rules.d/99-uinput.ruleswithKERNEL=="uinput", SUBSYSTEM=="misc", TAG+="uaccess", or add your user to theinputgroup:sudo usermod -aG input $USERand reload udev:sudo udevadm control --reload-rules && sudo udevadm trigger). - Tray: pystray needs PyGObject and an AppIndicator typelib. If the pink icon never appears,
install them (Ubuntu:
gir1.2-ayatanaappindicator3-0.1). - Camera: PipeWire/v4l2 (
/dev/video0). Pick a camera by number in the tray menu if the default is wrong. - Speed: encoder runs on CPU unless you install the CUDA build of PyTorch (same as Windows). Training on your face is CPU-only and slower than on Apple Silicon.
- Cleanup: the in-process MLX model is Mac-only. Use Claude (
export ANTHROPIC_API_KEY=…) or Ollama (ollama pull qwen3:4b, thenuv run lipflow --cleanup ollama) for better accuracy. - Context / corrections: names come from the active window title (Hyprland:
hyprctl; Sway:swaymsg; KDE:kdotool; X11:xdotool). GNOME has no stable title API. Learning from in-field corrections is Mac-only for now (same as Windows). - Global hotkey & Wayland triggers: on Wayland Lipflow can read the keyboard from
/dev/inputif your user is in theinputgroup. Alternatively, on compositors where you prefer system shortcuts (KDE Plasma, GNOME, Hyprland, Sway), bind any shortcut key in your desktop settings to:lipflow trigger-toggle: toggle recording (press once to start hands-free, press again to stop and type; Esc cancels).lipflow trigger-start/lipflow trigger-stop: push-to-talk key down / key up.lipflow trigger-cancel: cancel current dictation. X11 uses the standard key hook as on Windows.
Docker (Linux)
You can also run Lipflow in an isolated container with webcam, GUI, and GPU pass-through:
# 1. Download model weights locally
./scripts/download-models.sh
# 2. Run Lipflow via Docker (non-root, X11/Wayland display and GPU pass-through)
./scripts/docker-run.sh
# Or with Docker Compose:
docker compose up lipflow-gui
# (with NVIDIA GPU: docker compose -f docker-compose.yml -f docker-compose.gpu.yml up lipflow-gui)
Most accurate: whisper mode
Settings → Whisper mode. While you hold the key, Lipflow also listens to a soft whisper and reads lips + audio together with the Auto-AVSR audio-visual model (downloaded the first time, 1.8 GB). On test sentences, lips alone got 31.9% of words wrong; lips + audio got 6.9%. A real whisper is less clear than those test clips, so expect somewhere in between. The mic is only on while you hold the key.
Learning from your corrections
When you fix a word Lipflow typed (within about 30 seconds), it saves that clip with your corrected sentence, and the next Practice & train more round uses it. Only the text field it pasted into is read. Switch it off in Settings.
Better accuracy: turn on LLM cleanup
Lip reading can't tell apart words that look the same on the lips (p/b/m, f/v, t/d/n…), so the raw
model output reads like "WALLET OFFICER" when you said "while in office". Lipflow sends the model's
top-3 guesses plus your last few dictations to an LLM, which picks the sentence you meant and
fixes casing, punctuation and numbers. You choose which one under Cleanup in the menu bar (tray
on Windows), or with --cleanup <name> for one run. Automatic, the default, uses Claude if you've
set a key, otherwise the on-device model (Apple Silicon), otherwise Ollama if it's running, otherwise the offline rules.
- Claude:
export ANTHROPIC_API_KEY=…(modelclaude-opus-5-5at low effort; override withLIPFLOW_MODEL, e.g.LIPFLOW_MODEL=claude-haiku-4-5for lower latency). Best at fixing badly mis-read sentences. - ChatGPT (Codex CLI): uses your ChatGPT plan, no API key. Install the
Codex CLI (
brew install --cask codexornpm install -g @openai/codex), runcodex login, then pick it in the menu. Each sentence is one read-onlycodex execrun in an empty folder. Override the model withLIPFLOW_CODEX_MODEL. - On-device model: Qwen3-0.6B 4-bit running in-process on Apple Silicon
via MLX. About 350 MB, downloaded on first launch, and about 0.2 s per sentence, fully offline.
Tiny models copy the formatting they're shown, so this one gets lowercase guesses and a few
worked examples (
SMALL_SHOTSincleanup.py). Override withLIPFLOW_LOCAL_MODEL. - Ollama:
ollama pull qwen3:4b, then pick it in the menu (override withLIPFLOW_OLLAMA_MODEL). - Offline rules: sentence case, "I", end punctuation, "nineteen forty three" → 1943.
Learn from your Wispr Flow history. Most of what you'll mouth is stuff you already say.
uv run lipflow import-wispr # or: --from-text my-writing.txt
This reads Wispr Flow's local database read-only, prints only counts, and saves your phrases to
~/Library/Application Support/Lipflow/phrases.txt. Nothing leaves your Mac. Lipflow then:
picks between the lip-reader's top 5 guesses using a small model of the word pairs you use;
shows the cleanup model your past sentences closest to what it read; and adds names you
capitalise often to your custom words for review. Restart Lipflow afterwards.
Custom words. Names are the hardest thing to lip-read (a name is just lip shapes). Put yours
in the Lipflow menu → Edit custom words, one per line (~/Library/Application Support/Lipflow/words.txt).
A guess that contains one of your words wins over the others and gets your capitalization, and
the LLM is told about them.
Using it
| Do this | To |
|---|---|
| Hold Right Option, mouth the words, release | dictate |
| Double-tap Right Option … tap again | hands-free (up to 60 s) |
| Esc while listening | cancel |
| Lipflow menu → Copy last dictation / Open history | get text back |
Lipflow keeps filming for 0.4 s after you release the key, because the model needs the frames after the last word to read it.
Options: uv run lipflow --help
--key {right_option,left_option,right_command,right_control,fn}
--cleanup {auto,claude,local,ollama,basic}
--beam N beam size (default 10)
--copy-only copy to the clipboard instead of pasting
--camera N|FILE camera index, or a video file to stand in for the webcam
Lip-read a video file: uv run lipflow file talk.mp4 --start 10 --end 20
How it works
- Model: Auto-AVSR visual-only speech recognition trained on LRS3 (19.1% WER on the benchmark). A 3D-conv ResNet front end and a Conformer encoder feed a Transformer decoder plus CTC, with a subword Transformer language model in the beam search.
- Preprocessing: MediaPipe FaceLandmarker runs on every frame while you're recording, so there's no second detection pass afterwards. Eye, nose-base and mouth anchors are aligned to the training mean face, then 96×96 grayscale mouth crops are resampled to the 25 fps the model expects.
- Speed (M4 Pro, 9 s utterance): encoder 0.16 s on the Apple GPU (it's 1.7 s on CPU), beam
search about 0.8–1.6 s on CPU (faster than MPS for thousands of tiny ops), for about 1–2 s from
release to text. Those M4 Pro numbers predate the decoding changes below, which were measured on
a 4-core x86 CPU;
uv run lipflow benchmeasures your machine. - Decoding: patches to the vendored ESPnet: cross-attention keys/values are projected once per utterance instead of per hypothesis per step; the decoder and the language model cache each layer's self-attention keys/values instead of re-projecting the whole prefix every step; CTC prefix scoring is vectorised (and works on any device); and the search stops as soon as the 5 best results can no longer change (every score only falls as a sentence grows). Same output, beam search 1.55× faster.
- While you talk: each live preview keeps the mouth crops and front-end features that can no longer change, so letting go leaves only the last ~20 frames, the Conformer and the search (half the encoder's work at release on a CPU). The models are built without random init first (every weight is loaded right after), so the model is ready about 40% sooner.
Accuracy on held-out news footage (public-domain White House addresses), raw model output:
| Said | Read |
|---|---|
| Born in New York City, and raised mostly in Chicago, Nancy Davis graduated from Smith College in 1943. | BORN IN NEW YORK CITY AND RAISED MOSTLY IN CHICAGO NANCY DAVIS GRADUATED FROM SMITH COLLEGE IN NINETEEN FORTY THREE |
| …a real-life Hollywood romance with the love of her life, Ronald Reagan, whom she married in 1952. | ROMANCE WITH THE LOVE OF HER LIFE RONALD REAGAN WHOM SHE MARRIED IN NINETEEN FIFTY TWO |
| Presidents have delivered some form of final message while in office - a farewell address to the American people. | PRESIDENTS HAVE DELIVERED SOME FORM OF FINAL MESSAGE WHILE IN OFFICE FAREWELL ADDRESS TO THE AMERICAN PEOPLE |
Silently mouthed speech is harder than filmed speech (smaller lip movements), so expect more errors on your own webcam. That's what the LLM cleanup is for.
Development
./setup.sh --samples # also fetch the public-domain test clips
uv run pytest # the paste test is opt-in: LIPFLOW_TEST_PASTE=1
uv run lipflow bench # WER and speed on the 38 sample sentences (--limit N for fewer)
On Windows: setup.ps1 -Samples, then uv run pytest. CI runs the whole Windows setup and reads
a real clip on every push (.github/workflows/windows.yml).
Code map: lipflow/face.py (landmarks → mouth crops), vsr.py (model), camera.py, hotkey.py
(Quartz event tap; pynput's macOS listener crashes on recent macOS), paste.py, hud.py,
cleanup.py, app.py (wiring + menu bar). Windows: lipflow/win/ (tray app, overlay, setup
window, pynput key hook, clipboard paste). Shared by both: ptt.py (key timing), dictation.py,
practice.py. See NOTICE for bundled code and model licensing.
The LRS3-trained weights are for non-commercial research use.
License
MIT, see LICENSE. Bundled third-party code keeps its own license, listed in NOTICE. The model weights that setup.sh downloads come from the LRS3 dataset, which is for non-commercial research use only.
관련 프로젝트 살펴보기
불러오는 중…