Skip to content

Chris2003/Local-AI-Image-Generator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

πŸ–ΌοΈ Local AI Image Generator

An easy, zero-setup Stable Diffusion GUI for Windows & Linux. Run GGUF & Safetensors models offline without Python configuration.

Generation Workspace Model Library Image Constraints

πŸŽ₯ Watch the Setup & Demo Video: https://youtu.be/ESELhY-G_9w

Local AI Image Generator Video Tutorial

πŸ“– Overview

Local AI Image Generator is a zero-configuration, portable desktop environment for running Stable Diffusion (Safetensors/GGUF/CKPT) offline on Windows and Linux. Running start.bat (Windows) or ./start.sh (Linux) automatically handles dependency setup, GPU backend matching (CUDA/Vulkan on Windows, Vulkan on Linux), and launches a high-performance local web workspace.


⚑ Quick Start

Windows

  1. Launch: Double-click start.bat (downloads portable Node.js and pre-compiled GPU backend binaries on first run).
  2. Add Models: Drop .safetensors, .gguf, or .ckpt weights into app/models/ (or download them via the Model Manager tab in the UI).
  3. Generate: Open http://localhost:1420 in your browser, select your model, and write a prompt.

Linux (Ubuntu/Debian and other glibc distros)

  1. Launch: From a terminal, run ./start.sh (on first run it installs the Vulkan backend and uses your system Node.js, or downloads a portable copy if needed).
  2. Add Models: Drop .safetensors, .gguf, or .ckpt weights into app/models/ (or download them via the Model Manager tab in the UI).
  3. Generate: Your browser opens http://localhost:1420 automatically β€” select your model and write a prompt.

Linux requirements: a 64-bit (x86_64) glibc system, plus unzip and either curl or wget. For GPU acceleration install the Vulkan loader and a Vulkan driver β€” e.g. sudo apt install libvulkan1 mesa-vulkan-drivers vulkan-tools. No GPU? It runs on CPU automatically.


✨ Features

  • 100% Offline & Private: Inference runs completely locally on your hardware.
  • Auto-Detected GPU Acceleration: Configures CUDA for Nvidia cards, and Vulkan for AMD or Intel Arc GPUs.
  • GPU Device Picker (Multi-GPU): On machines with more than one GPU (e.g. a discrete card plus an integrated one), choose exactly which GPU runs generation under Image Constraints β†’ System Settings β†’ GPU Device. Auto prefers a dedicated card with matrix-core acceleration.
  • Zero System Footprint: Node.js is sandboxed inside the folder. No global environment paths are altered.
  • Integrated Model Manager: Paste a Hugging Face URL to download weights directly, or drag-and-drop local weight files to import them.
  • Real-time Telemetry: Monitor RAM, VRAM, CPU, and GPU load directly in the UI.
  • Local Gallery: Saves generated PNGs alongside prompt metadata JSONs to app/outputs/.

πŸ“ Repository Structure

local-ai-image-generator/
β”œβ”€β”€ start.bat                  # Windows double-click entrypoint
β”œβ”€β”€ start.sh                   # Linux entrypoint (./start.sh)
β”œβ”€β”€ LICENSE                    # MIT Open Source license
β”œβ”€β”€ .gitignore
β”œβ”€β”€ README.md                  
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ setup.ps1              # Windows: GPU-detect and environment installer
β”‚   β”œβ”€β”€ setup.sh               # Linux: installs Vulkan backend + Node, builds UI
β”‚   β”œβ”€β”€ reset.ps1              # Windows: cleans runtime envs (keeps models & outputs)
β”‚   β”œβ”€β”€ reset.sh               # Linux: cleans runtime envs (keeps models & outputs)
β”‚   └── serve.cjs              # Cross-platform UI web server + backend lifecycle manager
└── app/
    β”œβ”€β”€ frontend/              # UI source code (Vite + React)
    β”œβ”€β”€ dist/                  # Prebuilt UI served by serve.cjs
    β”œβ”€β”€ backend/win/           # Windows backend binaries (CUDA / Vulkan)
    β”œβ”€β”€ backend/linux/         # Linux backend (sd-vulkan + libstable-diffusion.so)
    β”œβ”€β”€ models/                # Place weights here (.safetensors, .gguf, .ckpt)
    └── outputs/               # Saved images and parameters metadata

πŸ–₯️ GPU Compatibility Matrix

GPU Vendor Tech Status Notes
Nvidia CUDA βœ… Native Maps sd-cuda.exe with Nvidia SDK 12 optimizations.
AMD Radeon Vulkan βœ… Native Maps sd-vulkan.exe with Vulkan API acceleration.
Intel Arc Vulkan βœ… Native Maps sd-vulkan.exe for Intel hardware.
Integrated / None CPU ⚠️ Fallback Runs on logical CPU threads (slow).

Linux note: the Linux build ships the Vulkan backend (app/backend/linux/sd-vulkan), which accelerates AMD, Intel, and Nvidia GPUs through a single binary, with automatic CPU fallback. CUDA-specific binaries are Windows-only in this project; on Linux, Nvidia cards are driven through their Vulkan driver. For an Nvidia/AMD-specific Linux build (CUDA or ROCm), compile stable-diffusion.cpp and drop the resulting sd-server + libstable-diffusion.so into app/backend/linux/ (renaming sd-server to sd-vulkan).

Multiple GPUs? When the Vulkan backend sees more than one device (common with an Nvidia/AMD card alongside a CPU's integrated GPU), the GPU Device dropdown in Image Constraints β†’ System Settings lets you pick which one runs generation. Auto scores the detected devices and prefers a dedicated card with matrix-core (Tensor/coopmat) support over an integrated GPU or software rasterizer. Note: a single image always runs on one device β€” stable-diffusion.cpp does not split one generation across multiple GPUs.


⏱️ Performance Benchmarks

Typical generation times for an image with 20 steps (e.g. 512x512 resolution; actual times can vary depending on specific hardware specifications, clock speeds, and system load):

  • CUDA GPU (Nvidia RTX): ~10 seconds.
  • Vulkan GPU (AMD / Intel Arc): ~89 seconds.
  • GTX Vulkan Fallback (Nvidia GTX): ~30 seconds (Vulkan runs significantly faster on legacy GTX series cards since they lack Tensor Cores).
  • CPU (Fallback): ~150 - 300+ seconds (highly dependent on processor core count, speed, and AVX instruction sets).

πŸ› οΈ Troubleshooting

  • Reset Environment: If a build fails or you want to clear dependencies, run scripts/reset.ps1 (Windows) or scripts/reset.sh (Linux). This preserves your models and generated images.
  • Port Conflicts: The frontend uses 1420 by default. The backend tries 8080 first, then automatically falls back to a free port if 8080 is already busy.
  • Linux β€” "cannot open shared object file": the backend needs libstable-diffusion.so next to sd-vulkan; serve.cjs sets LD_LIBRARY_PATH automatically. If you launched the binary by hand, run it from app/backend/linux/ or export that directory on LD_LIBRARY_PATH.
  • Linux β€” no GPU detected: install the Vulkan loader/driver (sudo apt install libvulkan1 mesa-vulkan-drivers vulkan-tools) and verify with vulkaninfo --summary. Without a Vulkan device the app still works on CPU.
  • Wrong GPU is used (e.g. integrated instead of your discrete card): on systems with multiple GPUs the Vulkan backend may default to the first device, which can be a CPU's integrated GPU. Open Image Constraints β†’ System Settings β†’ GPU Device and select your discrete card (or leave it on Auto, which prefers the dedicated GPU). Run vulkaninfo --summary to see how the devices are ordered.

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file. Bundles stable-diffusion.cpp (MIT License). Model weights are subject to their respective creators' licenses.

About

A fully self-contained, offline AI image generation studio for Linux. Runs Stable Diffusion (Safetensors/GGUF) locally with zero manual setup. Auto-configures CUDA for Nvidia GPUs and Vulkan for AMD/Intel Arc cards. Zero system-wide dependencies required.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 77.9%
  • CSS 12.3%
  • PowerShell 4.7%
  • Shell 4.0%
  • Other 1.1%