web-stable-diffusion
Bringing stable diffusion models to web browsers. Everything runs inside the browser with no server support.
Web Stable Diffusion brings AI image generation directly into a web browser, with no server involved. Stable diffusion is a type of AI model that creates photorealistic or stylized images from a text prompt. Normally these models require a powerful GPU-equipped server to run. This project is the first known implementation that runs the entire thing inside the browser itself.
The technical approach relies on two newer web standards: WebAssembly, which lets code written in lower-level languages run inside a browser, and WebGPU, which gives web pages direct access to the computer's graphics processor. By compiling the AI model down to these formats, the project can skip the server entirely and run generation on the user's own hardware.
Setting this up is not a one-click process. Getting it running locally involves installing a Python environment, a framework called TVM Unity, Rust, a WebAssembly build tool called wasm-pack, a static site generator called Jekyll, and Chrome Canary (a developer-only version of Chrome that has WebGPU enabled). A Jupyter notebook walks through each step: importing the model, optimizing it, compiling it, and then deploying it either locally or via the browser. For the browser deployment specifically, the model is compiled to a WebGPU build target and the output is served through a local web server.
The project is aimed at developers interested in running AI models on the client side rather than a server. The potential benefits the README cites are lower costs for service providers, better privacy for users, and reduced dependence on cloud infrastructure.
A demo is available on the project's web page. The repository also links to a related project called Web LLM, which applies the same approach to text-generating chat models.