Spaces:
Runtime error
Runtime error
metadata
title: Avatar Generator
emoji: 👔
colorFrom: blue
colorTo: green
sdk: docker
sdk_version: latest
app_file: app.py
pinned: false
Avatar Generator API
A streamlined, Diffusers-based implementation for generating avatar images using SDXL, ControlNet, and face conditioning.
Overview
This application provides a direct alternative to ComfyUI for avatar generation, focusing on:
- Reliability: Direct control over file paths and permissions
- Performance: Optimized pipeline for faster generation
- Simplicity: Clean FastAPI-based architecture
- Extensibility: Easy to modify and enhance
Features
- Pose-controlled generation using ControlNet
- FastAPI endpoints for image generation
- Face conditioning for consistent identity
- Docker-based deployment for Hugging Face Spaces
- Proper path handling to avoid permission issues
API Usage
The application exposes a /generate endpoint that accepts:
prompt: Text description of the desired imagename: Person name (used for filename)role: Role/job (used for styling and filename)pose_image: Reference image for poseshirt_image: Reference image for clothingface_image: (Optional) Reference image for face identitysteps: (Optional) Number of inference stepsguidance_scale: (Optional) How strongly to weight the promptwidth&height: (Optional) Output image dimensionsseed: (Optional) For reproducible generations
Models
The application uses:
- SDXL Base:
stabilityai/stable-diffusion-xl-base-1.0 - ControlNet:
thibaud/controlnet-openpose-sdxl-1.0 - PuLID Models:
Defter77/pulid-models
Environment Variables
The following environment variables can be set:
HF_TOKEN: Hugging Face API token for private modelsHF_HOME,HF_HUB_CACHE,TRANSFORMERS_CACHE: Set to/app/.cacheby default
Development
To run locally:
# Build the Docker image
docker build -t avatar-generator .
# Run the container
docker run -p 7860:7860 avatar-generator
Advantages Over ComfyUI
This implementation offers several benefits:
- Direct File Control: Explicit handling of file paths and permissions
- Simplified Architecture: No complex node graph to maintain
- Reliable Error Handling: Proper error reporting and cleanup
- Flexible API: Easy to integrate with other applications
- Optimized Resources: More efficient memory usage
Credits
Created by Defter77, based on the Hugging Face Diffusers library.