From 2caba855d1d1270c99252bb88d883e28e2c49b9f Mon Sep 17 00:00:00 2001 From: "kyj@bowong.ai" Date: Mon, 7 Jul 2025 17:54:27 +0800 Subject: [PATCH] =?UTF-8?q?ADD=20=E5=A2=9E=E5=8A=A0llm=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comfyui_v2.py | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/comfyui_v2.py b/comfyui_v2.py index 9e9836e..7ffb69e 100644 --- a/comfyui_v2.py +++ b/comfyui_v2.py @@ -3,45 +3,32 @@ import subprocess import modal -image = ( # build up a Modal Image to run ComfyUI, step by step - modal.Image.debian_slim( # start from basic Linux with Python +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( # use comfy-cli to install ComfyUI and its dependencies + .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://e.coding.net/g-ldyi2063/dev/ComfyUI-CustomNode.git", force_build=True) - .run_commands("comfy node install https://github.com/yolain/ComfyUI-Easy-Use.git", force_build=True) - # .add_local_file("ext/webhook_forward.py", "/root/comfy/ComfyUI/custom_nodes/webhook_forward.py", copy=True) - # .add_local_file("ext/prompt_id_generator.py", "/root/comfy/ComfyUI/custom_nodes/prompt_id_generator.py", copy=True) - # .add_local_file("ext/load_image_pro.py", "/root/comfy/ComfyUI/custom_nodes/load_image_pro.py", copy=True) - # .add_local_file('ext/image.py', '/root/comfy/ComfyUI/custom_nodes/image.py', copy=True) - # .add_local_file('ext/nodes_bfl.py', '/root/comfy/ComfyUI/comfy_api_nodes/nodes_bfl.py', copy=True) - # # .add_local_file('ext/s3_utils.py', '/root/comfy/ComfyUI/custom_nodes/s3_utils.py', copy=True) - # .add_local_file('ext/cos_utils.py', '/root/comfy/ComfyUI/custom_nodes/cos_utils.py', copy=True) - # .add_local_file('ext/random_line.py', '/root/comfy/ComfyUI/custom_nodes/random_line.py', copy=True) + .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(name="test", image=image) -vol = modal.Volume.from_name("test", environment_name="dev", create_if_missing=True) +app = modal.App(image=image) custom_secret = modal.Secret.from_name("comfyui-custom-secret", environment_name="dev") -# modal deploy .\comfyui_v2.py --name dev -@app.cls( - max_containers=1, # limit interactive session to 1 container - # gpu="L40S", # good starter GPU for inference - volumes={"/cache": vol}, # mounts our cached models +@app.function( + max_containers=1, secrets=[custom_secret] ) @modal.concurrent( max_inputs=10 -) # required for UI startup process which runs several API calls concurrently +) @modal.web_server(8000, startup_timeout=60) -class ModalComfy(): - +def ui(): subprocess.Popen("comfy launch -- --cpu --listen 0.0.0.0 --port 8000", shell=True)