StableSwarmUI
StableSwarmUI, A Modular Stable Diffusion Web-User-Interface, with an emphasis on making powertools easily accessible, high performance, and extensibility.
Top Related Projects
Stable Diffusion web UI
Invoke is a leading creative engine for Stable Diffusion models, empowering professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry leading WebUI, and serves as the foundation for multiple commercial products.
The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface.
Let us control diffusion models!
Quick Overview
The Stability-AI/StableSwarmUI repository is a user interface for the Stable Diffusion AI model, which is a powerful text-to-image generation tool. The project aims to provide a simple and intuitive way for users to interact with the Stable Diffusion model and generate high-quality images from text prompts.
Pros
- User-friendly Interface: The project provides a clean and intuitive user interface, making it easy for users to generate images without needing to interact with the underlying model directly.
- Customizable Prompts: Users can create and customize their own text prompts to generate unique and personalized images.
- Batch Processing: The UI supports batch processing, allowing users to generate multiple images at once.
- Flexible Output Options: Users can choose to save the generated images in various formats, including PNG and JPEG.
Cons
- Limited Functionality: The project is primarily focused on the user interface and may not provide advanced features or customization options that some users might desire.
- Dependency on Stable Diffusion: The project's functionality is entirely dependent on the Stable Diffusion model, which means that any issues or limitations with the model will be reflected in the UI.
- Potential Performance Issues: Generating high-quality images can be computationally intensive, and the UI may struggle to provide a smooth experience on lower-end hardware.
- Licensing Concerns: The Stable Diffusion model has some licensing restrictions, which may impact the project's usage or distribution.
Getting Started
To get started with the Stability-AI/StableSwarmUI project, follow these steps:
- Clone the repository:
git clone https://github.com/Stability-AI/StableSwarmUI.git
- Navigate to the project directory:
cd StableSwarmUI
- Install the required dependencies:
pip install -r requirements.txt
- Run the application:
python app.py
-
Open your web browser and navigate to
http://localhost:7860
to access the Stable Diffusion UI. -
Start generating images by entering your desired text prompt and adjusting the various settings.
That's it! You're now ready to use the Stability-AI/StableSwarmUI project to generate images using the Stable Diffusion model.
Competitor Comparisons
Stable Diffusion web UI
Pros of stable-diffusion-webui
- More mature and established project with a larger user base and community support
- Extensive collection of extensions and plugins available
- Highly customizable interface with advanced features for power users
Cons of stable-diffusion-webui
- Steeper learning curve for beginners due to its complexity
- Can be resource-intensive, especially with multiple extensions enabled
- Setup process can be more involved, particularly for non-technical users
Code Comparison
StableSwarmUI:
def generate_images(prompt, num_images=1, guidance_scale=7.5, steps=50):
images = pipeline(prompt, num_images=num_images, guidance_scale=guidance_scale, num_inference_steps=steps)
return images
stable-diffusion-webui:
def generate(self, prompt, negative_prompt="", steps=20, cfg_scale=7, width=512, height=512):
result = self.process_images(prompt=prompt, negative_prompt=negative_prompt, steps=steps, cfg_scale=cfg_scale, width=width, height=height)
return result
Both repositories offer powerful tools for generating images using Stable Diffusion models. StableSwarmUI aims to provide a more user-friendly interface with a focus on ease of use, while stable-diffusion-webui offers a feature-rich environment with extensive customization options. The code comparison shows similar approaches to image generation, with stable-diffusion-webui offering more granular control over parameters.
Invoke is a leading creative engine for Stable Diffusion models, empowering professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry leading WebUI, and serves as the foundation for multiple commercial products.
Pros of InvokeAI
- More mature project with a larger community and longer development history
- Offers a wider range of features and customization options
- Supports multiple backends (PyTorch, ONNX) for improved performance
Cons of InvokeAI
- Steeper learning curve due to more complex interface and options
- Requires more system resources for optimal performance
- Less frequent updates compared to StableSwarmUI
Code Comparison
InvokeAI:
from invokeai.app.services.image_generation import ImageGenerationService
generator = ImageGenerationService()
result = generator.generate(prompt="A beautiful landscape")
StableSwarmUI:
from stableswarmui import StableSwarmUI
swarm = StableSwarmUI()
result = swarm.generate_image(prompt="A beautiful landscape")
Both repositories provide powerful tools for AI image generation, but they cater to different user needs. InvokeAI offers more advanced features and customization options, making it suitable for experienced users and developers. StableSwarmUI, on the other hand, focuses on simplicity and ease of use, making it more accessible to beginners and those who prefer a streamlined experience. The choice between the two depends on the user's specific requirements, technical expertise, and desired level of control over the image generation process.
The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface.
Pros of ComfyUI
- More flexible and customizable workflow system
- Supports a wider range of AI models and techniques
- Better suited for advanced users and researchers
Cons of ComfyUI
- Steeper learning curve for beginners
- Less user-friendly interface compared to StableSwarmUI
- Requires more manual configuration and setup
Code Comparison
ComfyUI example (workflow definition):
{
"3": {
"inputs": {
"seed": 4,
"steps": 20,
"cfg": 8,
"sampler_name": "euler",
"scheduler": "normal",
"denoise": 1,
"model": ["4", 0],
"positive": ["6", 0],
"negative": ["7", 0],
"latent_image": ["5", 0]
},
"class_type": "KSampler"
}
}
StableSwarmUI example (configuration):
{
"model": "stable-diffusion-v1-5",
"prompt": "A beautiful landscape",
"negative_prompt": "ugly, blurry",
"width": 512,
"height": 512,
"num_inference_steps": 50,
"guidance_scale": 7.5
}
Let us control diffusion models!
Pros of ControlNet
- Offers fine-grained control over image generation through various conditioning methods
- Supports multiple pre-trained models for different tasks (e.g., edge detection, pose estimation)
- Provides extensive documentation and examples for implementation
Cons of ControlNet
- Requires more technical knowledge to set up and use effectively
- Limited user interface options, primarily focused on command-line usage
- May have higher computational requirements due to its complex architecture
Code Comparison
ControlNet:
from annotator.util import resize_image, HWC3
from annotator.canny import ControlNetCannyDetector
detector = ControlNetCannyDetector()
image = resize_image(HWC3(image), 512)
detected_map = detector(image, low_threshold, high_threshold)
StableSwarmUI:
const swarm = new StableSwarmUI({
apiKey: 'your-api-key',
modelName: 'stable-diffusion-v1-5'
});
swarm.generateImage('A beautiful landscape', 512, 512);
While ControlNet focuses on providing low-level control and flexibility, StableSwarmUI aims to simplify the image generation process with a more user-friendly approach. ControlNet's code example demonstrates its advanced image processing capabilities, while StableSwarmUI's code showcases its straightforward API for generating images.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
StableSwarmUI
StableSwarmUI 0.6.4.1 Beta.
A Modular Stable Diffusion Web-User-Interface, with an emphasis on making powertools easily accessible, high performance, and extensibility.
Join the Discord to discuss the project, get support, see announcements, etc.
Follow the Feature Announcements Thread for updates on new features.
Migration Notice
As of 2024/06/21 StableSwarmUI will no longer be maintained under Stability AI.
The original developer will be maintaining an independent version of this project as mcmonkeyprojects/SwarmUI
Windows users can migrate to the new independent repo by simply updating and then running migrate-windows.bat
For Linux, Mac, or manual Windows: open a terminal in your Swarm folder then run git remote set-url origin https://github.com/mcmonkeyprojects/SwarmUI
See full migration guide here: https://github.com/mcmonkeyprojects/SwarmUI/discussions/2
Status
This project is in Beta status. This means for most tasks, Swarm has excellent tooling available to you, but there is much more planned. Swarm is recommended as an ideal UI for most users, beginners and pros alike. There are still some things to be worked out.
Beginner users will love Swarm's primary Generate tab interface, making it easy to generate anything with a variety of powerful features. Advanced users may favor the Comfy Workflow tab to get the unrestricted raw graph, but will still have reason to come back to the Generate tab for convenience features (image editor, auto-workflow-generation, etc) and powertools (eg Grid Generator).
Those interested in helping push Swarm from Beta to a Full ready-for-anything perfected Release status are welcome to submit PRs (read the Contributing document first), and you can contact us here on GitHub or on Discord. I highly recommend reaching out to ask about plans for a feature before PRing it. There may already be specific plans or even a work in progress.
Key feature targets not yet implemented:
- Better mobile browser support
- full detail "Current Model" display in UI, separate from the model selector (probably as a tab within the batch sidebar?)
- And a way to dynamically shift tabs around between spots for convenience / layout customization
- LLM-assisted prompting
- convenient direct-distribution of Swarm as a program (Electron app?)
Try It On Google Colab or Runpod
Google Colab
WARNING: Google Colab does not necessarily allow remote WebUIs, particularly for free accounts, use at your own risk.
Colab link if you want to try Swarm: https://colab.research.google.com/github/Stability-AI/StableSwarmUI/blob/master/colab/colab-notebook.ipynb
Runpod
Runpod template (note: maintained by third party contributor nerdylive123): https://runpod.io/console/deploy?template=u7mlkrmxq3&ref=c6jd6jj0
Note it may take several minutes to start up the first time. Check the container logs to see setup progress. Check the template ?
info for hints on how to use.
Installing on Windows
Note: if you're on Windows 10, you may need to manually install git and DotNET 8 first. (Windows 11 this is automated).
- Download The Install-Windows.bat file, store it somewhere you want to install at (not
Program Files
), and run it.- It should open a command prompt and install itself.
- If it closes without going further, try running it again, it sometimes needs to run twice. (TODO: Fix that)
- It will place an icon on your desktop that you can use to re-launch the server at any time.
- When the installer completes, it will automatically launch the StableSwarmUI server, and open a browser window to the install page.
- Follow the install instructions on the page.
- After you submit, be patient, some of the install processing take a few minutes (downloading models and etc).
(TODO): Even easier self-contained pre-installer, a .msi
or .exe
that provides a general install screen and lets you pick folder and all.
Alternate Manual Windows Install
- Install git from https://git-scm.com/download/win
- Install DotNET 8 SDK from https://dotnet.microsoft.com/en-us/download/dotnet/8.0 (Make sure to get the SDK x64 for Windows)
- open a terminal to the folder you want swarm in and run
git clone https://github.com/Stability-AI/StableSwarmUI
- open the folder and run
launch-windows.bat
Installing on Linux
-
Install
git
,python3
via your OS package manager if they are not already installed (make sure to includepip
andvenv
on distros that do not include them in python directly)- For example, on recent Ubuntu versions,
sudo apt install git python3-pip python3-venv
- For example, on recent Ubuntu versions,
-
Download the install-linux.sh file, store it somewhere you want to install at, and run it
- If you like terminals, you can open a terminal to the folder and run the following commands:
wget https://github.com/Stability-AI/StableSwarmUI/releases/download/0.6.1-Beta/install-linux.sh -O install-linux.sh
chmod +x install-linux.sh
- If you like terminals, you can open a terminal to the folder and run the following commands:
-
Run the
./install-linux.sh
script, it will install everything for you and eventually open the webpage in your browser. -
Follow the install instructions on-page.
-
You can at any time in the future run the
launch-linux.sh
script to re-launch Swarm. -
If the page doesn't open itself, you can manually open
http://localhost:7801
Alternate Manual Linux Install
- Install
git
,python3
via your OS package manager if they are not already installed (make sure to includepip
andvenv
on distros that do not include them in python directly)- For example, on recent Ubuntu versions,
sudo apt install git python3-pip python3-venv
- For example, on recent Ubuntu versions,
- Install DotNET 8 using the instructions at https://dotnet.microsoft.com/en-us/download/dotnet/8.0 (you need
dotnet-sdk-8.0
, as that includes all relevant sub-packages)- Some users have said that certain Linux distros expect
aspnet-runtime
to be installed separately
- Some users have said that certain Linux distros expect
- Open a shell terminal and
cd
to a directory you want to install into - Run shell commands:
git clone https://github.com/Stability-AI/StableSwarmUI
- cd
StableSwarmUI
./launch-linux.sh
- open
http://localhost:7801/Install
(if it doesn't launch itself) - Follow the install instructions on-page.
(TODO): Maybe outlink a dedicated document with per-distro details and whatever. Maybe also make a one-click installer for Linux?
Installing on Mac
Note: You can only run StableSwarmUI on Mac computers with M1 or M2 (Mx) Apple silicon processors.
- Open Terminal.
- Ensure your
brew
packages are updated withbrew update
. - Verify your
brew
installation withbrew doctor
. You should not see any error in the command output. - Install .NET for macOS:
brew install dotnet
. - If you don't have Python, install it:
brew install python@3.10
andbrew install virtualenv
- Change the directory (
cd
) to the folder where you want to install StableSwarmUI. - Clone the StableSwarmUI GitHub repository:
git clone https://github.com/Stability-AI/StableSwarmUI
. cd StableSwarmUI
and run the installation script:./launch-macos.sh
.
The installation starts now and downloads the Stable Diffusion models from the internet. Depending on your internet connection, this may take several minutes. Wait for your web browser to open the StableSwarmUI window.
During the StableSwarmUI installation, you are prompted for the type of backend you want to use. For Mac computers with M1 or M2, you can safely choose the ComfyUI backend and choose the Stable Diffusion XL Base and Refiner models in the Download Models screen.
Running with Docker
- To forward an Nvidia GPU, you must have the Nvidia Container Toolkit installed: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
- Open a shell terminal and
cd
to a directory you want to install into - Run shell commands:
git clone https://github.com/Stability-AI/StableSwarmUI
- cd
StableSwarmUI
./launch-docker.sh
- Open your browser to
localhost:7801
- Note that it will forward the
Models
andOutput
directory, and will mountData
anddlbackend
as independent persistent volumes.
Documentation
Motivations
The "Swarm" name is in reference to the original key function of the UI: enabling a 'swarm' of GPUs to all generate images for the same user at once (especially for large grid generations). This is just the feature that inspired the name and not the end all of what Swarm is.
The overall goal of StableSwarmUI is to a be full-featured one-stop-shop for all things Stable Diffusion.
See the motivations document for motivations on technical choices.
Legal
This project:
- embeds a copy of 7-zip (LGPL).
- has the ability to auto-install ComfyUI (GPL).
- has the option to use as a backend AUTOMATIC1111/stable-diffusion-webui (AGPL).
- can automatically install christophschuhmann/improved-aesthetic-predictor (Apache2).
- can automatically install yuvalkirstain/PickScore (MIT).
- can automatically install git-for-windows (GPLv2).
- can automatically install MIT/BSD/Apache2/PythonSoftwareFoundation pip packages: spandrel, dill, imageio-ffmpeg, opencv-python-headless, matplotlib, rembg, kornia, Cython
- can automatically install ultralytics (AGPL) for
YOLOv8
face detection (ieSwarmYoloDetection
node or<segment:yolo-...>
syntax usage may become subject to AGPL terms), - can automatically install insightface (MIT) for
IP Adapter - Face
support - uses JSON.NET (MIT), FreneticUtilities (MIT), LiteDB (MIT), ImageSharp (Apache2 under open-source Split License)
- embeds copies of web assets from BootStrap (MIT), Select2 (MIT), JQuery (MIT), exifr (MIT).
- has the option to connect to remote servers to use the Stability AI API as a backend.
- supports user-built extensions which may have their own licenses or legal conditions.
StableSwarmUI itself is under the MIT license, however some usages may be affected by the GPL variant licenses of connected projects list above, and note that any models used have their own licenses.
License
The MIT License (MIT)
Copyright (c) 2024 Stability AI
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Top Related Projects
Stable Diffusion web UI
Invoke is a leading creative engine for Stable Diffusion models, empowering professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry leading WebUI, and serves as the foundation for multiple commercial products.
The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface.
Let us control diffusion models!
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot