ofxUnpaint? Creating a stable diffusion addon?

Would it be difficult to make an addon from this c++ stable diffusion implementation? GitHub - axodox/unpaint: A simple Windows / Xbox app for generating AI images with Stable Diffusion.

It depend on this lib, that is written by the same author: GitHub - axodox/axodox-machinelearning: This repository contains a C++ ONNX implementation of StableDiffusion.

As a standalone app it works very well.

I only need the basic functionality, but all the features are nice (the UI too, actually).

Loading .onnx files with OF works with ofxOrt, but it could also work with other approaches (like it is done in unpaint, for example).

Here is a working example: GitHub - Jonathhhan/ofStableDiffusionExample
It is an implementation of: GitHub - leejet/stable-diffusion.cpp: Stable Diffusion in pure C/C++

It is quite slow, because it runs on the CPU (but GPU support is planned).
Because of that I choose to use the SD 2.1 Nano network (with a size of 128 x 128).

2 Likes

This one is for SD 2.1 with 768x768: GitHub - Jonathhhan/ofStableDiffusionExample-768
Compiling with CPU instructions can make a big difference: CPU Optimization Flags (-march) using Make - #7 by Jona

Here an example with the prompt: a red bed on a high mountain, van gogh
It took 142 seconds with 8 steps.

1 Like