Skip to content

Commit

Permalink
Add ComfyUI example (#66)
Browse files Browse the repository at this point in the history
* Add ComfyUI example

* fix name
  • Loading branch information
bddppq authored Dec 15, 2023
1 parent efe802a commit 2f3443e
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
36 changes: 36 additions & 0 deletions advanced/comfyui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# ComfyUI

[ComfyUI](https://github.com/comfyanonymous/ComfyUI.git) is a powerful and modular stable diffusion GUI and backend that let you design and execute advanced stable diffusion pipelines using a graph/nodes/flowchart based interface.

## Install Lepton sdk
```shell
pip install leptonai
```

## Launch Stable Diffusion web UI in the cloud

Similar to other examples, you can run ComfyUI on Lepton Cloud Platform easily, e.g.:

```shell
lep photon create -n comfyui -m photon.py
lep photon push -n comfyui
lep photon run \
-n comfyui \
--resource-shape gpu.a10
--public
```

You can visit [dashboard.lepton.ai](https://dashboard.lepton.ai/) to use the web Dashboard, or use `lep` cli to manage the launched deployment:
```shell
lep deployment status -n comfyui
```

## Client

Once the ComfyUI server is up, you can copy the deployment url shown on the Lepton Dashboard (or in the `lep` cli output)

<img src="assets/deployment.png" width=1024>

and visit it in the web browser. e.g. running the sdxl + svd models to do text to video:

<img src="assets/browser.png" width=1024>
Binary file added advanced/comfyui/assets/browser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added advanced/comfyui/assets/deployment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions advanced/comfyui/photon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from leptonai.photon import Photon


class ComfyUI(Photon):
comfyui_version = "329c571"
cmd = [
"bash",
"-c",
(
"pip install aiohttp einops torchsde &&"
"git clone --recursive https://github.com/comfyanonymous/ComfyUI.git && cd"
f" ComfyUI && git checkout {comfyui_version} && python main.py --listen"
" 0.0.0.0 --port 8080"
),
]
deployment_template = {
"resource_shape": "gpu.a10",
}

0 comments on commit 2f3443e

Please sign in to comment.