npm install
npm run buildor download the latest build from the website!
- open
chrome://extensions, turn on developer mode - click load unpacked and pick either your unzipped folder from the website or
dist/from your build - the settings page opens on install. allow the camera there once, pick a webcam
- (optionally) paste a TypeSafe API key so Jev can catch laughs the local matcher misses
(don't forget to reload your chat tabs to apply the extension!)
in short: Jev detects whether your message is supposed to express laughter or not, a custom-trained CV model asks whether or not you're actually laughing, and then a facial recognition model puts stickers around your face and turns you into a hilarious GIF.
(faces are checked locally, your data is never sent for processing elsewhere (besides anything uploaded to social media, obviously)
src/content.tswatches enter and send clicks in every text box. if the message was a laugh and the site cleared the box (i.e. actually sent it), it pastes the GIF into the box and sends it (with configurable delay).src/lib/detect.tsholds the instant local laugh matcher. anything it doesn't match by regex goes to Jev as a yes/no question.src/offscreen.tsowns the camera, so the camera permission is granted once instead of on every site.- while enabled,
src/offscreen.tscontinuously prepares one GIF at a time by capturing the user's face and applying modificationssrc/lib/face.tsdecides where labels and stickers can go, and animations are applied afterwards
- while enabled,
- sending a GIF pulls the latest completed GIF, prioritizing a remembered smile when that setting is on (i.e., if you just smiled, count that one)
after too many times caught "laughing" with a straight face (configurable under apology in settings; 0 turns it off), you won't be allowed to chat until you submit a 5-second apology video.
- each camera frame is drawn once and JPEG-encoded off the main thread, and the microphone's samples are copied as they arrive
- once recording ends, in one pass:
- MediaPipe HandLandmarker (
public/models/hand_landmarker.task) runs on the MediaPipe WASM runtime already used for face detection, in video tracking mode, on a 320 px copy of every 2nd frame. a ukelele appears in and follows your hands to give your apology a touch of musical talent src/lib/apology-music.tspreloads the first five seconds ofpublic/ukelele.mp3, resamples it to the microphone rate, and caches its dominant pitch classes.src/lib/ukulele-audio.tshard-snaps the voice to those notes to create a homemade "vocoding" effect in the nearest vocal octave using TD-PSOLA (time-domain pitch-synchronous overlap-and-add)- frames go to the browser's (usually hardware) video encoder through WebCodecs, and Mediabunny writes the MP4
- MediaPipe HandLandmarker (
src/lib/apology-recorder.ts records in the offscreen page, and src/lib/apology-modal.ts is the modal in the chat page. Run npm run test:apology-audio to check pitch matching, mixing, timing, and clipping (requires FFmpeg to decode the bundled MP3).
public/models/smile.onnx is trained on the FEI Face Database: 200 people, each photographed neutral and smiling. FEI has no "laughing" label, so the model detects smiling. Cross-validated accuracy on people it never saw is in public/models/smile.json (93.8% at last training).
webcam photos and training images go through the same normalization, defined in src/lib/face-spec.json: eyes placed at fixed positions in a 64×64 crop, grayscale, histogram-equalized, standardized.
to retrain (needs uv; downloads FEI into the gitignored data/):
npm run train
npm run buildThe FEI Face Database is for research use only and may not be redistributed. Please cite: C. E. Thomaz and G. A. Giraldi, "A new ranking method for Principal Components Analysis and its application to face image analysis", Image and Vision Computing, 28(6), 2010.
as a developer, i likely won't be actively maintaining this project myself unless something big happens with it, as it was designed to be a fun one-off hackathon project. however, feel free to contribute or do whatever you like with the code, if there's interest in this project, i might consider returning to it :)

