Spaces:
Running
Running
Commit History
-
Portraits: in-browser WebGPU via vendored Bonsai (FLUX.2-Klein 4B, on-device)
Replaces the broken Janus engine with Bonsai Image 4B (FLUX.2-Klein, 1-bit/ternary, Apache-2.0) — the only in-browser WebGPU image model that actually works (verified SOTA-quality portraits on an RTX 3090). Bonsai's engine is a bespoke WGSL app with a custom 1-bit weight packing and no JS API, so we can't load its weights into a generic pipeline. Instead we VENDOR its self-contained static bundle (index.html + one 912 KB JS, Apache-2.0) under web/bonsai/ and run it in a same-origin hidden iframe, driving its UI directly (load → prompt → GENERATE → read the output <img> into a Blob via canvas). Same-origin is the key: it avoids the cross-origin background-throttling that hung earlier iframe attempts, and lets us drive the app's DOM directly (no postMessage bridge). Desktop-only (~4-5 GB model); shown disabled on mobile, where cloud FLUX serves instead. Verified end-to-end in the persona panel: load → paint → 512² portrait cached per hero. Co-Authored-By: Claude Opus 4.8 (1M context) …db6b273