Spaces:
Runtime error
title: Real-Time Latent Consistency Model Image-to-Image ControlNet
emoji: 🖼️🖼️
colorFrom: gray
colorTo: indigo
sdk: docker
pinned: false
suggested_hardware: a10g-small
Real-Time Latent Consistency Model
This demo showcases Latent Consistency Model (LCM) using Diffusers with a MJPEG stream server.
You need a webcam to run this demo. 🤗
See a collecting with live demos here
Running Locally
You need CUDA and Python 3.10, Mac with an M1/M2/M3 chip or Intel Arc GPU
TIMEOUT
: limit user session timeoutSAFETY_CHECKER
: disabled if you want NSFW filter offMAX_QUEUE_SIZE
: limit number of users on current app instanceTORCH_COMPILE
: enable if you want to use torch compile for faster inference works well on A100 GPUs
Install
python -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
LCM
Image to Image
uvicorn "app-img2img:app" --host 0.0.0.0 --port 7860 --reload
Image to Image ControlNet Canny
Based pipeline from taabata
uvicorn "app-controlnet:app" --host 0.0.0.0 --port 7860 --reload
Text to Image
uvicorn "app-txt2img:app" --host 0.0.0.0 --port 7860 --reload
LCM + LoRa
Using LCM-LoRA, giving it the super power of doing inference in as little as 4 steps. Learn more here or technical report
Image to Image ControlNet Canny LoRa
uvicorn "app-controlnetlora:app" --host 0.0.0.0 --port 7860 --reload
Text to Image
uvicorn "app-txt2imglora:app" --host 0.0.0.0 --port 7860 --reload
Setting environment variables
TIMEOUT=120 SAFETY_CHECKER=True MAX_QUEUE_SIZE=4 uvicorn "app-img2img:app" --host 0.0.0.0 --port 7860 --reload
If you're running locally and want to test it on Mobile Safari, the webserver needs to be served over HTTPS.
openssl req -newkey rsa:4096 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem
uvicorn "app-img2img:app" --host 0.0.0.0 --port 7860 --reload --log-level info --ssl-certfile=certificate.pem --ssl-keyfile=key.pem
Docker
You need NVIDIA Container Toolkit for Docker
docker build -t lcm-live .
docker run -ti -p 7860:7860 --gpus all lcm-live
or with environment variables
docker run -ti -e TIMEOUT=0 -e SAFETY_CHECKER=False -p 7860:7860 --gpus all lcm-live
Demo on Hugging Face
https://huggingface.co/spaces/radames/Real-Time-Latent-Consistency-Model