Stable Diffusion demo

image of a macaroni and meat dish
An AI interpretation of a comfort food

Stable Diffusion has recently gained a lot of attention in the AI and computer vision community. It is a diffusion model trained on text prompts and images, able to generate images that somehow resemble the given textual prompt. The implementation and trained weights of the model have been made publicly available, in contrast to e.g. Google’s Imagen.

I’ve put together a small demo of the model using the following Python libraries: gradio, transformers and diffusers. Gradio provides an easy way to setup simple web interfaces to test machine learning models. I’m also using a machine translation model from huggingface to translate Finnish prompts to English, which is the language expected by the Stable Diffusion model.

While setting up this demo, I also needed to figure out the ways to install CUDA in WSL2/Ubuntu on Windows, as well as setting port forwarding and firewall rules to enable access to the gradio app running within WSL2 from the local network.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.