A modern, user-friendly interface for Stable Diffusion image generation with advanced features
Installation β’ Features β’ Documentation β’ Contributing
# Clone the repository
git clone https://github.com/yourusername/stable-diffusion-client
cd stable-diffusion-client
# Install dependencies
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
pip install -r requirements.txt
# Start the server
python server.py
# In a new terminal, start the client
python client.py
Visit http://localhost:7860
to access the web interface.
A comprehensive Stable Diffusion interface system combining a FastAPI server with a Gradio web client. This system provides advanced image generation capabilities, model management, and image-to-video conversion features through an intuitive user interface.
- π¨ Interactive Web Interface: Intuitive Gradio-based UI with organized tabs and controls
- π€ Model Management:
- Support for both local
.safetensors
models and online Hugging Face models - Model comparison capabilities
- Automatic model scanning and loading
- Support for both local
- πΌοΈ Image Generation:
- Batch processing support
- Custom scheduler configurations
- Adjustable generation parameters
- Real-time status updates
- π₯ Image-to-Video Conversion:
- Multiple animation presets
- Region-based animation (face, body, background)
- Customizable motion types
- Duration and frame control
- π Advanced Features:
- Side-by-side model comparison
- Automatic memory optimization
- Comprehensive metadata tracking
- Progress monitoring
- πΎ Project Management:
- Organized output structure
- Metadata preservation
- Prompt set management
- Python 3.8+
- CUDA-capable GPU
- PyTorch with CUDA support
- FastAPI and dependencies
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
pip install -r requirements.txt
python server.py
The server will:
- Scan for local models in the
models
directory - Display available models (local and online)
- Prompt for model selection
- Initialize the selected model
- Start the FastAPI server on port 8001
models/
βββ model1.safetensors # Local model file
βββ model1.json # Optional metadata
βββ model2.safetensors
βββ model2.json
{
"model_type": "SD", // or "SDXL"
"base_model": "SD 1.5",
"description": "Model description",
"merged_from": ["model1", "model2"]
}
python client.py [--port PORT] [--share] [--debug]
- Server URL configuration (default: http://localhost:8001)
- Model refresh functionality
- Connection status monitoring
- Prompt set management through YAML files
- Prompt set selection
- Configuration status display
- Model selection (single or multiple for comparison)
- Image dimensions (256-1024 pixels)
- Generation steps (1-100)
- Guidance scale (1-20)
- Scheduler configuration
- Batch size control
- Output directory management
- Main prompt input
- Negative prompt input
- Real-time validation
- Generation controls
- Progress monitoring
- Image gallery
- Status updates
- Animation presets:
- Subtle: 20 frames, 2 seconds
- Normal: 24 frames, 2 seconds
- Slow: 40 frames, 8 seconds
- Ultra slow: 40 frames, 12 seconds
- Region selection
- Motion type configuration
- Custom output settings
{
"prompt": str,
"negative_prompt": str = "",
"width": int = 512, # 384-2048
"height": int = 512, # 384-2048
"num_steps": int = 30, # 1-150
"guidance_scale": float = 7.5, # 1.0-20.0
"scheduler_type": str = "dpmsolver++",
"karras_sigmas": bool = True,
"enable_attention_slicing": bool = True,
"enable_vae_slicing": bool = True,
"enable_vae_tiling": bool = True
}
POST /generate
: Generate images with specified parametersGET /models
: List available modelsGET /health
: Check server status and GPU informationPOST /compare
: Generate images with multiple models
{
"status": "ok",
"cuda_available": true,
"model_loaded": true,
"current_model": {
"name": "Model Name",
"type": "SD/SDXL",
"base_model": "Base Model Info",
"default_size": 512
},
"gpu_info": {
"name": "GPU Name",
"total_memory_gb": "16.00",
"used_memory_gb": "4.00",
"free_memory_gb": "12.00"
}
}
outputs/
βββ images/
β βββ prefix_model_timestamp.png
β βββ prefix_model_timestamp_0.png
β βββ ...
βββ metadata/
βββ prefix_model_timestamp.yaml
βββ prefix_model_timestamp_0.yaml
- Monitor GPU memory through the health endpoint
- Use batch sizes appropriate for your GPU
- Enable memory optimizations for large models
- Consider model type when selecting resolution
- Start with default settings
- Use comparison mode to evaluate models
- Save successful prompts
- Monitor generation status
- Select appropriate animation presets
- Verify server connection before generation
- Monitor generation status
- Check error messages in status area
- Use appropriate model for desired resolution
- Fork the repository
- Create a feature branch
- Implement changes
- Submit a pull request
git clone https://github.com/SikamikanikoBG/ImageGenerator
cd stable-diffusion-client
pip install -r requirements.txt
- Stability AI for Stable Diffusion
- Hugging Face for model distribution
- Gradio team for the UI framework
- FastAPI team for the server framework