Stable Diffusion 3: A Web Interface Built with Rio
With the recent release of Stable Diffusion 3, I decided to create a simple web interface for it using the Python-only Rio framework. This article provides a step-by-step guide on how to build your own Stable Diffusion web interface.
Getting Started
To begin, you’ll need to install at least one model from the list below. Rio makes it easy to get started with Stable Diffusion. You can find installation instructions in the project’s README.
Installing the Project
Clone this repository and install the project and its dependencies. This will download some large packages like diffusers and torch. Give it a few minutes to complete.
Running the Interface
After installation, run the interface. This will display a URL in the console. Open this URL in your browser to start using the interface.
Installing Models
When you first connect, you won’t have any models installed yet. The site will automatically allow you to download one of the built-in models. Note that diffusers doesn’t seem to offer any way to track the download progress of models, so you won’t be able to see how far the download has progressed in the interface. Check the terminal to see updates.
Generating Images
Type a prompt of what you’d like to see, click “Generate,” and wait for your masterpiece to be created :)
Tech Stack
All models are run with the diffusers library from Hugging Face. There is a thin wrapper around the library to workaround some issues and make it easier to use. The web interface is built with Rio, a new web framework that is designed to be 100% Python, and as easy to use as possible.
Caveats
Stable Diffusion 3 is still very new, and support in diffusers is immature. This has led to a couple of known problems:
- Generating non-square images can lead to errors from PyTorch. Stick to aspect ratios of 1:1 for now.
- Freeing up memory is very unreliable. On some devices, the model keeps gobbling up more and more RAM as time goes on, while on others, it seems to free up just fine. Keep a close eye on your memory usage.
Stable Diffusion 3
Rio Framework
Diffusers Library