Skip to main content

Image and video generator using ComfyUI as a library

Project description

SwitchGen

A Linux-native AI image generator with a GTK4 interface. Uses ComfyUI as an embedded library for Stable Diffusion workflows.

Features

  • Text-to-image generation
  • Image-to-image transformation
  • Inpainting with mask support
  • Audio generation (Stable Audio)
  • 3D novel view synthesis (Zero123)
  • Built-in model downloader for HuggingFace models
  • Real-time generation progress
  • VRAM monitoring and cleanup

Installation

Arch Linux (AUR)

yay -S switchgen-git

Manual Installation

1. Clone with submodules

git clone --recursive https://github.com/Djwarf/switchgen.git
cd switchgen

If already cloned without submodules:

git submodule update --init --recursive

2. Install system dependencies

# Arch Linux
sudo pacman -S gtk4 libadwaita python-gobject python-pytorch python-torchvision

# Other distributions
# Install GTK4, libadwaita, PyGObject, and PyTorch with CUDA support

3. Install Python package

pip install -e .

Usage

Launch the application:

switchgen

Or run as a module:

python -m switchgen

First Run

  1. Click the download button in the header bar to open the model manager
  2. Download required models (checkpoints, VAE, CLIP, etc.)
  3. Select a workflow type and checkpoint
  4. Enter a prompt and click Generate

Project Structure

switchgen/
├── src/switchgen/
│   ├── core/
│   │   ├── comfy_init.py    # ComfyUI initialization
│   │   ├── config.py        # Path and app configuration
│   │   ├── downloader.py    # HuggingFace model downloader
│   │   ├── engine.py        # Generation engine
│   │   ├── models.py        # Model catalog
│   │   ├── queue.py         # Job queue system
│   │   └── workflows.py     # Workflow builders
│   │
│   ├── ui/
│   │   ├── main_window.py   # Main GTK4 window
│   │   ├── model_dialog.py  # Model download dialog
│   │   └── styles/          # CSS themes
│   │
│   └── resources/
│       └── fonts/           # Bundled fonts
│
├── vendor/
│   └── ComfyUI/             # Bundled ComfyUI engine (submodule)
│
├── models/                  # Downloaded models
├── custom_nodes/            # User custom nodes
├── output/                  # Generated images
└── temp/                    # Temporary files

Supported Workflows

Workflow Description Required Models
Text2Img Generate images from text prompts Checkpoint, VAE
Img2Img Transform existing images Checkpoint, VAE
Inpaint Edit specific regions with masks Checkpoint, VAE
Audio Generate audio from text Stable Audio checkpoint
3D Generate novel views of objects Zero123 checkpoint, CLIP ViT-L

Model Storage

Models are stored in the models/ directory:

models/
├── checkpoints/      # Main model files (.safetensors, .ckpt)
├── vae/              # VAE models
├── clip_vision/      # CLIP vision encoders
├── text_encoders/    # Text encoders (T5, etc.)
├── controlnet/       # ControlNet models
├── loras/            # LoRA adapters
└── upscale_models/   # Upscaling models

Requirements

  • Python 3.10 or later
  • GTK4 and libadwaita
  • PyTorch with CUDA support
  • NVIDIA GPU with 8GB+ VRAM recommended

Configuration

The application auto-detects paths. To override:

  • Set COMFYUI_PATH environment variable to use an external ComfyUI installation
  • Models are stored in ./models/ relative to the application root

Troubleshooting

Missing models error

Open the model download dialog and download the required models for your workflow.

VRAM out of memory

  • Close other GPU applications
  • Use smaller image dimensions
  • Try a different checkpoint (some use less VRAM)

Custom nodes not loading

Place custom node folders in the custom_nodes/ directory and restart the application.

License

MIT License. See LICENSE file for details.

Credits

  • ComfyUI by comfyanonymous
  • Stable Diffusion by Stability AI
  • GTK4 and libadwaita by GNOME

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

switchgen-0.1.1.tar.gz (6.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

switchgen-0.1.1-py3-none-any.whl (391.5 kB view details)

Uploaded Python 3

File details

Details for the file switchgen-0.1.1.tar.gz.

File metadata

  • Download URL: switchgen-0.1.1.tar.gz
  • Upload date:
  • Size: 6.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for switchgen-0.1.1.tar.gz
Algorithm Hash digest
SHA256 db60e2a4d1faee2ceea21008c2d528203d4b8f0e6324aedef3ffa5a9c7df3ca3
MD5 2bebcec23bff8e5abb30e3c1c69e5842
BLAKE2b-256 255e175949876edad40b4f275f6bc5477f8e4d826838defeb847fb458b44e297

See more details on using hashes here.

File details

Details for the file switchgen-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: switchgen-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 391.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for switchgen-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ecbb4d82bc4351bdcdece7b75746336bae8a260a28770ca38f0ead05047ca51c
MD5 f8fff9284949fa85bbf90ee3c89bdba6
BLAKE2b-256 c9bb114ebb2cfa3b30643863b3388b69d5c0285659be752ca7e822bc92a6828b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page