feat(#1520): Selfie generative background + cartoonify (client-side) - #1565
Merged
Conversation
…ied) - scripts/vendor-animegan.mjs: idempotent vendor script (sentinel + SHA-256 guard); model sourced from akhaliq/AnimeGANv2-ONNX on HF, upstream weights MIT-licensed (bryandlee/animegan2-pytorch © 2021 Bryan Lee); SHA-256 1381b17ed988e14a1f3cf8954d88073c0884ff4b70128ebe599f0d6021bca63e - hugo/static/vendor/animegan/model.onnx: face_paint_512_v2_0, 8.59 MB - hugo/static/vendor/animegan/.animegan-vendored-version: sentinel - hugo-apps/package.json: add onnxruntime-web ^1.20.0 (installed 1.21.0); add vendor:animegan script - package.json: add vendor:animegan script; chain into build:apps after vendor:imgly
…AN model MIT requires the copyright notice be included in copies. Adds: - hugo/static/vendor/animegan/LICENSE — verbatim upstream MIT text (Copyright (c) 2021 Bryan Lee, from bryandlee/animegan2-pytorch) - hugo/static/vendor/animegan/ATTRIBUTION.md — provenance note: model name, ONNX source URL, upstream repo, SHA-256, and statement that the ONNX is a mechanical serialisation so the MIT licence carries forward
jung-thomas
marked this pull request as ready for review
August 9, 2026 00:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Selfie Tier 3 (#1520) — client-side generative background + cartoonify
Adds two 100% client-side capabilities to the Devtoberfest selfie composer (
/devtoberfest/selfie/), preserving the hard privacy promise — your photo never leaves the browser. No hosted inference, no photo egress; the only new network activity is loading same-origin assets (themed background PNGs + the ONNX model + onnxruntime-web's own bundled WASM).What's new
removeBgon (a themed background is meaningless without the cutout). Vector art generated at build time (SVG→PNG via sharp).face_paint_512_v2, ONNX, run in-browser viaonnxruntime-web). New async effect path; the model + runtime are lazy-imported so neither touches the page-load path.Architecture (Approach A — two independent bounded layers)
backgrounds.ts— scene definitions +backgroundUrlhelper.compose.ts—setBackground(img|null)on a bottom-mostbgLayer;exportPngnowawaits the async effect dispatcher (effect bakes before the polaroid border).stylize.ts—cartoonify(canvas); fail-soft (any failure returns the input canvas unchanged); a load failure clears the cached session so a later attempt can retry.effects.ts—'cartoon'effect id +applyEffectAsync(routes cartoon → cartoonify, delegates all other ids to syncapplyEffect).BackgroundPicker.vue+Composer.vuewiring (scene picker, cartoon busy spinner, Export disabled during bake).Licensing
The AnimeGANv2 model binary ships with a verbatim MIT
LICENSE(© 2021 Bryan Lee) +ATTRIBUTION.md(source URL, SHA-256, provenance) underhugo/static/vendor/animegan/. Vendored viascripts/vendor-animegan.mjs(idempotent, SHA-guarded, sentinel-tracked).Testing
vite buildclean (onnxruntime-web lazy-splits into its own chunk).Not covered / follow-up
/devtoberfest/selfie/is the post-merge step — the onnxruntime-web WASM resolution under the approuter CSP can only be confirmed in a real browser (unit tests mock ORT). The imgly precedent (fix(selfie): attach camera after DOM mount; scope 'unsafe-eval' CSP to /devtoberfest/* #1546) already proved the CSP permits'wasm-unsafe-eval'+'unsafe-eval'.🤖 Generated with Claude Code