• Stars
    star
    850
  • Rank 53,217 (Top 2 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created 11 months ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

App showcasing multiple real-time diffusion models pipelines with Diffusers
title emoji colorFrom colorTo sdk pinned suggested_hardware
Real-Time Latent Consistency Model Image-to-Image ControlNet
πŸ–ΌοΈπŸ–ΌοΈ
gray
indigo
docker
false
a10g-small

Real-Time Latent Consistency Model

This demo showcases Latent Consistency Model (LCM) using Diffusers with a MJPEG stream server. You can read more about LCM + LoRAs with diffusers here.

You need a webcam to run this demo. πŸ€—

See a collecting with live demos here

Running Locally

You need CUDA and Python 3.10, Node > 19, Mac with an M1/M2/M3 chip or Intel Arc GPU

Install

python -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
cd frontend && npm install && npm run build && cd ..
python run.py --reload --pipeline controlnet

Pipelines

You can build your own pipeline following examples here here, don't forget to fuild the frontend first

cd frontend && npm install && npm run build && cd ..

LCM

Image to Image

python run.py --reload --pipeline img2img 

LCM

Text to Image

python run.py --reload --pipeline txt2img 

Image to Image ControlNet Canny

python run.py --reload --pipeline controlnet 

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

python run.py --reload --pipeline controlnetLoraSD15

or SDXL, note that SDXL is slower than SD15 since the inference runs on 1024x1024 images

python run.py --reload --pipeline controlnetLoraSDXL

Text to Image

python run.py --reload --pipeline txt2imgLora

or

python run.py --reload --pipeline txt2imgLoraSDXL

Setting environment variables

TIMEOUT: limit user session timeout
SAFETY_CHECKER: disabled if you want NSFW filter off
MAX_QUEUE_SIZE: limit number of users on current app instance
TORCH_COMPILE: enable if you want to use torch compile for faster inference works well on A100 GPUs USE_TAESD: enable if you want to use Autoencoder Tiny

If you run using bash build-run.sh you can set PIPELINE variables to choose the pipeline you want to run

PIPELINE=txt2imgLoraSDXL bash build-run.sh

and setting environment variables

TIMEOUT=120 SAFETY_CHECKER=True MAX_QUEUE_SIZE=4 python run.py --reload --pipeline txt2imgLoraSDXL

If you're running locally and want to test it on Mobile Safari, the webserver needs to be served over HTTPS, or follow this instruction on my comment

openssl req -newkey rsa:4096 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem
python run.py --reload --ssl-certfile=certificate.pem --ssl-keyfile=key.pem

Docker

You need NVIDIA Container Toolkit for Docker, defaults to `controlnet``

docker build -t lcm-live .
docker run -ti -p 7860:7860 --gpus all lcm-live

or with environment variables

docker run -ti -e PIPELINE=txt2imgLoraSDXL -p 7860:7860 --gpus all lcm-live

Development Mode

python run.py --reload  

Demo on Hugging Face

https://huggingface.co/spaces/radames/Real-Time-Latent-Consistency-Model

lcm-real.mp4

More Repositories

1

LLM-automator

Create keyboard shortcuts for an LLM using OpenAI GPT, Ollama, HuggingFace with Automator on macOS.
Python
130
star
2

Machine-Learning-Ethics-References

List of references about Machine Learning bias and ethics
58
star
3

NTP_RTC_Sync

RTC Clock Sync with the NTP Protocol on ESP8266 Arduino
Arduino
17
star
4

ai-town-huggingface

AI town https://github.com/a16z-infra/ai-town Patches to run on Hugging Face Spaces
TypeScript
15
star
5

observablehq-viewer

Simple service to generate Observablehq notebooks previews outside Observablehq UI. It's also reproducing Observablehq UI styles
CSS
12
star
6

gradio-rerun-viewer

Rerun viewer with Gradio
Python
12
star
7

tinystories-candle-wasm

JavaScript
10
star
8

mac-to-ip

Python script using libnmap to find the IP address from an specific MAC address
Python
9
star
9

sentence-embeddings-visualization

Python
8
star
10

google-fonts-analytics-archive

Archiving Google Fonts analytics data for fun https://fonts.google.com/analytics
6
star
11

face-landmarks-gradio

TypeScript
5
star
12

Ising-Model-WebGL

Simple Ising Model with WebGL Shader
HTML
3
star
13

NYTimes-homepage-rearranged-hf-spaces

Svelte
2
star
14

The-Kazimier-Procession

C++
2
star
15

wordalle

The game that marries DALLE mini & Wordle! Powered by dalle mini and huggingface spaces
Svelte
2
star
16

Minecraft-Solar-Explorations

Minecraft Server to play and explore scale model concepts using the solar system as reference
JavaScript
2
star
17

Youtube-Demonetized-Words-Study

Observable notebook import example on Nuxt.js / Vue.js application, generated as static page on github pages
JavaScript
2
star
18

my-first-blocks

TypeScript
1
star
19

Minecraft-ScriptCraft-mqtt-IoT

Ready to use Minecraft ScriptCraft and mqtt server, with python example
JavaScript
1
star
20

python_opencv_camera_haar

Simple code example of Python with Opencv and camera face detection with haar classifiers
Python
1
star
21

Gradio-Blender-bpy

Running Gradio with Blender BPY engine
Python
1
star
22

traduzirse

Vue
1
star
23

radames

1
star
24

jupyter_observable_widget

Experiment embedding Observablehq notebook inside a jupyter notebook
Jupyter Notebook
1
star
25

drawings-to-human

HTML
1
star
26

opencv_video_to_pygame

SImple example OpenCV VideoCapture running on PyGame
Python
1
star
27

gradio-sketch-canvas

Svelte
1
star
28

observablehq-web-component

A friendly web-component for rendering Observablehq notebooks cells as reusable encapsulated HTML tags
JavaScript
1
star
29

dataset-historical-daily-temperature-210-US

1
star
30

gradio-custom-components

My Gradio Custom Components WIP
CSS
1
star