Skip to content

Latest commit

 

History

History
82 lines (54 loc) · 2 KB

File metadata and controls

82 lines (54 loc) · 2 KB

Simple Qwen Image Layered Inference Server

A FastAPI server for decomposing images into semantic layers using the Qwen-Image-Layered diffusion model.

Features

  • Decompose input images into multiple semantic layers
  • RESTful API with automatic documentation
  • GPU acceleration support
  • Returns layered outputs as a ZIP file containing PNG images

Requirements

  • Python 3.11 or higher
  • CUDA-capable GPU (recommended for performance)
  • uv package manager

Setup

  1. Clone the repository:
git clone https://github.com/creative-graphic-design/simple-qwen-image-layered-inference
cd simple-qwen-image-layered-inference
  1. Install dependencies:
uv sync

Usage

Starting the Server

uv run fastapi run

The server will start at http://localhost:8000

API Documentation

Once the server is running, visit:

  • Interactive API docs: http://localhost:8000/docs
  • Alternative docs: http://localhost:8000/redoc

API Endpoint

POST /decompose

Decomposes an uploaded image into semantic layers.

Example Request

curl -X POST "http://localhost:8000/decompose?layers=4&num_inference_steps=50&seed=42" \
  -H "accept: application/zip" \
  -H "Content-Type: multipart/form-data" \
  -F "image_file=@your_image.jpg" \
  --output decomposed_layers.zip

Key Parameters

  • image_file: The image to decompose (required)
  • layers: Number of layers to generate (default: 4)
  • num_inference_steps: Denoising steps (default: 50, higher = better quality but slower)
  • seed: Random seed for reproducibility (default: 0)
  • prompt: Optional text prompt to guide layer generation
  • true_cfg_scale: Guidance scale for classifier-free guidance (default: 4.0)
  • resolution: Output resolution, choose from 640 or 1024 (default: 640)

Response

The endpoint returns a ZIP file containing the decomposed layers as PNG images (layer_1.png, layer_2.png, etc.).

License

MIT