35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
# 文件名 comfyui_v2.py
|
|
import subprocess
|
|
|
|
import modal
|
|
|
|
image = (
|
|
modal.Image.debian_slim(
|
|
python_version="3.10"
|
|
)
|
|
.apt_install("git", "gcc", "libportaudio2", "ffmpeg")
|
|
.pip_install("fastapi[standard]==0.115.4") # install web dependencies
|
|
.pip_install("comfy_cli==0.0.0",
|
|
index_url="https://packages-1747622887395:0ee15474ccd7b27b57ca63a9306327678e6c2631@g-ldyi2063-pypi.pkg.coding.net/dev/packages/simple")
|
|
.run_commands(
|
|
"comfy --skip-prompt install --fast-deps --nvidia --version 0.3.40"
|
|
)
|
|
.pip_install_from_pyproject("./pyproject_comfyui.toml")
|
|
.run_commands("comfy node install https://gitea.bowongai.com/bowong/ComfyUI-CustomNode.git")
|
|
.run_commands("comfy node install https://github.com/yolain/ComfyUI-Easy-Use.git")
|
|
)
|
|
app = modal.App(image=image)
|
|
custom_secret = modal.Secret.from_name("comfyui-custom-secret", environment_name="dev")
|
|
|
|
|
|
@app.function(
|
|
max_containers=1,
|
|
secrets=[custom_secret]
|
|
)
|
|
@modal.concurrent(
|
|
max_inputs=10
|
|
)
|
|
@modal.web_server(8000, startup_timeout=60)
|
|
def ui():
|
|
subprocess.Popen("comfy launch -- --cpu --listen 0.0.0.0 --port 8000", shell=True)
|