Your webcam is now a four-way gaze controller
Turns a browser webcam into a gaze input device by mapping TensorFlow.js face landmarks to four directions.

What it does
gaze-detection is a thin JavaScript wrapper around TensorFlow.js’s face-landmarks-detection model. It pulls frames from a webcam, infers facial geometry, and collapses that data into four discrete directions: RIGHT, LEFT, TOP, and STRAIGHT. The result is a coarse-grained eye-tracking API that runs entirely in the browser without native binaries or specialized hardware.
The interesting bit
The library bundles the whole ML pipeline—model loading, camera setup, and frame inference—into a few method calls that return human-readable directions instead of raw landmark arrays. The README also claims it runs on mobile browsers, relying only on a standard webcam rather than specialized eye-tracking hardware.
Key highlights
- Wraps TensorFlow.js face-landmark inference into four cardinal gaze directions
- Consumes any standard webcam feed via a
<video>element - Claims to work on mobile browsers, not just desktop
- Inspired by the Android accessibility app Look to speak
- Returns discrete string labels (
RIGHT,LEFT, etc.) rather than raw coordinates
Verdict
Worth a look if you are prototyping hands-free web interfaces, accessibility tools, or creative-coding experiments. Skip it if you need fine-grained pupillometry or sub-degree gaze accuracy; this is directional detection, not precision instrumentation.
Frequently asked
- What is charliegerard/gaze-detection?
- Turns a browser webcam into a gaze input device by mapping TensorFlow.js face landmarks to four directions.
- Is gaze-detection open source?
- Yes — charliegerard/gaze-detection is open source, released under the GPL-3.0 license.
- What language is gaze-detection written in?
- charliegerard/gaze-detection is primarily written in JavaScript.
- How popular is gaze-detection?
- charliegerard/gaze-detection has 647 stars on GitHub.
- Where can I find gaze-detection?
- charliegerard/gaze-detection is on GitHub at https://github.com/charliegerard/gaze-detection.