Stable Diffusion GUI is a PyQt5-based application for generating AI-generated images using Stable Diffusion. The interface allows users to input prompts, configure inference settings, and generate images seamlessly. The project integrates Hugging Face for model access and caching, ensuring an optimized user experience.
- Graphical User Interface (GUI) for Stable Diffusion.
- Prompt randomization for creative image generation.
- Adjustable inference steps and guidance scale.
- Multithreading support to prevent UI freezing during image generation.
- Hugging Face integration for authentication and model management.
- Configurable environment settings for GPU optimization.
Ensure you have the following installed:
- Python 3.8+
- PyQt5
- Pillow
- Hugging Face Hub
- Torch and CUDA (for GPU acceleration)
- Clone the repository:
git clone https://github.com/Abhijeet-Real/stable-diffusion.git cd stable-diffusion-gui - Install dependencies:
pip install -r requirements.txt
- Configure Hugging Face login credentials (see below).
- Run the application:
python StableDiffusionGUI.py
To use Hugging Face models, authentication is required. Create a file named Hugging Face inside the project directory with the following format:
Website: https://huggingface.co
User_Name: Your Hugging Face User Name
Token_Name: Your Hugging Face Token Name
Token: Your Hugging Face Token
The application reads the credentials from the Hugging Face file and logs in automatically.
This project uses relative paths for environment settings and resource files.
- Cache Directory: The Hugging Face model cache is stored inside
HuggingFace/HuggingFaceCache. - Environment Variables:
HF_HOME→ Sets the Hugging Face model cache location.CUDA_LAUNCH_BLOCKING=1→ Enables CUDA debugging.HF_HUB_DISABLE_SYMLINKS_WARNING=1→ Suppresses Hugging Face warnings.PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:128→ Optimizes GPU memory allocation.
- GUI Assets:
Stable Diffusion Icon.ico→ Application icon.Stable Diffusion Background.jpg→ Background image.
- Launch the GUI.
- Enter a filename and prompt or use Random Prompt.
- Adjust inference steps and guidance scale as needed.
- Click Generate to create an AI-generated image.
- Once completed, the image is saved and a success message is displayed.
- Ensure the Hugging Face credentials file exists and is correctly formatted.
- If models fail to load, check GPU compatibility and install CUDA if needed.
- Run the application from the
D:\Stable Diffusiondirectory to avoid relative path issues.
Feel free to fork and contribute via pull requests!
This project is open-source and available under the MIT License.