FahimF / sd-gui

Clean and simple Stable Diffusion GUI for macOS, Windows, and Linux
MIT License
230 stars 17 forks source link
linux macos pyqt5 python3 stablediffusion windows

Stable Diffusion GUI

This repo is my work in getting a functional and feature-rich GUI working for Stable Diffusion on the three major desktop OSes โ€” Windows, macOS, and Linux. All the development and testing was done on Apple Silicon macs, but the code does work on Windows and Linux as well. It has been tested under Windows and Linux, but not extensively โ€” if you find bugs, please do let me know and I'll fix them ๐Ÿ™‚

The aim of the GUI is to keep things as simple as possible and yet provide as many features as is necessary to get your work done should you do a lot of image generation using Stable Diffusion. The original aim was to keep the Python package requirements as low (and simple) as possible while providing a GUI that works on a Mac, Linux, or Windows. However, the package requirements might change as more functionality is added to the GUI.

Note: All development has been done on an Apple Silicon Mac and this has been optimized for Apple Silicon. It does work on Intel Macs as well but look at the Installation Errors section below for help if things go wrong with the installation. Also, on a 2017 MacBook Pro, it took about 40 minutes to generate a single image if you did the image generation locally! But, you can run the GUI locally and have the image generation happen remotely (on a different machine with a GPU, for example) to get much faster image generation.

01-main

gui(screens/mac-01-main.jpg) gui(screen/win-01-main.jpg) gui(screen/lin-01-main.jpg)
macOS Windows Linux

The GUI currently has the following functionality:

Installation

Before you start your installation, you might also want to sign up at Hugging Face since you'll need a Hugging Face user account in order to download the Stable Diffusion models. Do note also that you would need to visit the Hugging Face Stable Diffusion model page and accept their license before you would be able to download the model โ€” you'll need to download the model during the installation.

There's also an Installation Errors section further down in this document. Please refer to that if you run into issues since common issues that others have faced are documented there ๐Ÿ™‚

To get set up, you'll need to run the following commands in terminal one at a time. Do note that some of these commands would require you to make decisions and respond to prompts. If you are not comforable with that, this process might not be for you and you might wan to try one of the one-click installers listed here ๐Ÿ™‚

For installation instructions for each OS, refer to the relevant OS sub-document below for installation instructions. The sub-documents are a work in progress and will be updated over time as I test fully on each OS:

Running the GUI

Once you've complted the installation following the installation instructions above, if you are still at the terminal, simply type the following to launch the UI:

python app.py

If you closed the terminal or want to use the UI at some other point, you'd have to navigate back to where you have this repo (sd-gui) before you run the above command.

Note: If you are not familiar with conda, do note that every time you close your terminal, your Python environment will revert to the base environment when you next start a terminal session.

The base environment does not have all the packages you installed above since those are in the ml environment. So you have to switch to that environment (and navigate to the sd-gui folder) before you can run the GUI again. So you'll need to run something like the following each time you start a new terminal session:

conda activate ml
cd sd-gui
python app.py

Of course, in the above, change the cd sd-gui to put the actual location of sd-gui on your hard disk ๐Ÿ™‚

Running the Server

You can run the server from a terminal/command-line by simply running the following command:

python server.py

This should result in something like the following as output:

05-win-server

Once the server is running, you can connect to it from another machine using the server's IP and the port number 5000. So, if your server IP address is 192.168.0.11 as in the above screenshot, then run the GUI on your local machine, set the Server to Remote and then enter the IP and port number as follows before you generate an image:

06-connect-server

Using the GUI

There are tooltips for most UI elements explaining what they do. Just hover your mouse cursor ove a UI element like a button or combobox and a tooltip should appear explaining what that particular item does.

I will add more detailed how-tos for tasks later on once I can find some time ๐Ÿ™‚ (Or, if you'd like to contribute, add to the documentation and send me a pull request on GitHub and I'll merge the changes in.)

Installation Errors

Known Issues

FAQ (Frequently Asked Questions)

Credit