This is a local server for image generation, in the same way that Ollama is a local server for text generation, compliant with the OpenAI image generation API.
It uses Hugging Face's diffusers library to pull models from Hugging Face's model hub and generate images.
Install dependencies using uv (which automatically manages the virtual environment):
uv syncIf you don't have uv installed, install it first:
curl -LsSf https://astral.sh/uv/install.sh | shNote: This project now uses uv for dependency management. The old requirements.txt file is kept for reference, but all dependencies are now managed through pyproject.toml.
Run the server using uv:
uv run uvicorn src.main:app --reloaduv sync --devuv run pytest# Add a runtime dependency
uv add package-name
# Add a development dependency
uv add --dev package-nameuv sync --upgradecurl http://localhost:8000/models/list
curl -X POST http://localhost:8000/models/pull -d '{"url": "https://huggingface.co/CompVis/stable-diffusion-v1-4"}'
curl -X DELETE http://localhost:8000/models/CompVis/stable-diffusion-v1-4
curl -X POST http://localhost:8000/v1/images/generations -d '{"prompt": "A beautiful image of a cat", "n": 1, "size": "512x512", "model": "stable-diffusion-v1-5/stable-diffusion-v1-5", "response_format":"b64_json"}' --header "Content-Type: application/json"