TAAFT
Free mode
100% free
Freemium
Free Trial
Deals

Stable Diffusion Image Gallery

WhiskeyCoder / Stable-Diffusion-Gallery

A powerful Flask-based web application for managing, browsing, and organizing Stable Diffusion generated images with comprehensive metadata extraction and management capabilities.

7 2 Language: Python License: MIT Updated: 4mo ago

README

Stable Diffusion Image Gallery

A powerful Flask-based web application for managing, browsing, and organizing Stable Diffusion generated images with comprehensive metadata extraction and management capabilities.

dashboard

๐Ÿš€ Features

  • Multi-format Support: PNG, JPG, JPEG, WebP
  • Metadata Extraction: Automatic extraction from multiple SD tools:
    • AUTOMATIC1111
    • ComfyUI
    • InvokeAI
    • NovelAI
    • CivitAI
  • Smart Organization: Model-based categorization and tagging
  • Duplicate Detection: MD5 hash-based duplicate prevention
  • Search & Filter: Find images by model, tags, or prompt content
  • Responsive UI: Modern, mobile-friendly interface
  • API Support: RESTful endpoints for integration
  • Statistics: Comprehensive gallery analytics

๐Ÿณ Docker Deployment

  • https://hub.docker.com/r/whiskeycoder/stable-diffusion-gallery

Quick Start

  1. Clone the repository

    git clone https://github.com/WhiskeyCoder/Stable-Diffusion-Gallery.git
    cd stable_difusion_browser
  2. Build and run with Docker Compose

    docker-compose up -d
  3. Access the application

    • Open your browser and navigate to http://localhost:5000
    • The gallery will be available immediately

Production Deployment

For production use, enable the nginx reverse proxy:

docker-compose --profile production up -d

This will:

  • Run the Flask app on port 5000 (internal)
  • Expose the application on ports 80 (HTTP) and 443 (HTTPS)
  • Provide load balancing and SSL termination

Manual Docker Build

# Build the image
docker build -t sd-gallery .

# Run the container
docker run -d \
  --name sd-gallery \
  -p 5000:5000 \
  -v $(pwd)/gallery_images:/app/gallery_images \
  -v $(pwd)/image_database.json:/app/image_database.json \
  sd-gallery

๐Ÿ“ Directory Structure

stable_difusion_browser/
โ”œโ”€โ”€ sd_gallery_app.py          # Main Flask application
โ”œโ”€โ”€ requirements.txt            # Python dependencies
โ”œโ”€โ”€ Dockerfile                  # Docker image definition
โ”œโ”€โ”€ docker-compose.yml         # Docker Compose configuration
โ”œโ”€โ”€ .dockerignore              # Docker build exclusions
โ”œโ”€โ”€ README.md                  # This file
โ”œโ”€โ”€ gallery_images/            # Image storage directory
โ”œโ”€โ”€ image_database.json        # Image metadata database
โ””โ”€โ”€ templates/                 # HTML templates
    โ”œโ”€โ”€ base.html
    โ”œโ”€โ”€ gallery.html
    โ”œโ”€โ”€ upload.html
    โ”œโ”€โ”€ image_detail.html
    โ”œโ”€โ”€ edit_image.html
    โ”œโ”€โ”€ stats.html
    โ””โ”€โ”€ debug.html

๐Ÿ”ง Configuration

Environment Variables

  • FLASK_ENV: Set to production for production deployment
  • FLASK_APP: Main application file (default: sd_gallery_app.py)
  • FLASK_SECRET_KEY: Secret key for session management

Volume Mounts

  • ./gallery_images:/app/gallery_images: Persistent image storage
  • ./image_database.json:/app/image_database.json: Persistent metadata
  • ./templates:/app/templates: Customizable templates

๐Ÿ“Š Usage

Uploading Images

  1. Navigate to the Upload page
  2. Select an image file (PNG, JPG, JPEG, WebP)
  3. Optionally specify model name and content tags
  4. The system will automatically extract metadata
image-view
  • Main View: Browse all images with thumbnails
  • Filtering: Filter by model, tags, or search terms
  • Image Details: Click on any image for full metadata view
  • Edit Mode: Modify image metadata and tags

API Endpoints

  • GET /api/images: Retrieve all images as JSON
  • GET /image/<filename>: Serve image files
  • GET /image-detail/<id>: Get detailed image information

๐Ÿ›ก๏ธ Security Features

  • Non-root container execution
  • Health checks for monitoring
  • Input validation and sanitization
  • Secure file handling

๐Ÿ” Troubleshooting

Common Issues

  1. Port already in use

    # Check what's using port 5000
    lsof -i :5000
    # Or use a different port in docker-compose.yml
  2. Permission denied errors

    # Ensure proper ownership of mounted volumes
    sudo chown -R $USER:$USER gallery_images/
    sudo chown $USER:$USER image_database.json
  3. Container won't start

    # Check container logs
    docker-compose logs sd-gallery

Health Checks

The application includes built-in health checks:

  • Container health status: docker ps
  • Application health: curl http://localhost:5000/

๐Ÿ“ˆ Performance

  • Image Processing: Optimized metadata extraction
  • Database: Lightweight JSON-based storage
  • Caching: Efficient image serving
  • Memory: Minimal resource footprint

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test with Docker
  5. Submit a pull request

๐Ÿ“„ License

This project is open source. Please check the license file for details.

๐Ÿ†˜ Support

For issues and questions:

  • Check the troubleshooting section
  • Review container logs
  • Open an issue on GitHub

๐Ÿ”„ Updates

To update the application:

# Pull latest changes
git pull

# Rebuild and restart
docker-compose down
docker-compose up -d --build

Happy Image Management! ๐ŸŽจ

0 AIs selected
Clear selection
#
Name
Task