somethingg
This commit is contained in:
parent
dfd139294f
commit
224b006ec2
@ -1,6 +1,6 @@
|
||||
from config import config
|
||||
import modal
|
||||
from modal import Image, Mount, web_endpoint, Stub, asgi_app
|
||||
from modal import Image, Mount, web_endpoint, Stub, asgi_app
|
||||
import json
|
||||
import urllib.request
|
||||
import urllib.parse
|
||||
@ -30,13 +30,11 @@ print(config)
|
||||
print("deploy_test ", deploy_test)
|
||||
print('volumes', volumes)
|
||||
stub = Stub(name=config["name"])
|
||||
# print(stub.app_id)
|
||||
|
||||
if not deploy_test:
|
||||
# dockerfile_image = Image.from_dockerfile(f"{current_directory}/Dockerfile", context_mount=Mount.from_local_dir(f"{current_directory}/data", remote_path="/data"))
|
||||
# dockerfile_image = Image.from_dockerfile(f"{current_directory}/Dockerfile", context_mount=Mount.from_local_dir(f"{current_directory}/data", remote_path="/data"))
|
||||
|
||||
print("about to build image")
|
||||
dockerfile_image = (
|
||||
modal.Image.debian_slim()
|
||||
.apt_install("git", "wget")
|
||||
@ -55,6 +53,8 @@ if not deploy_test:
|
||||
"cd /comfyui/custom_nodes/ComfyUI-Manager && pip install -r requirements.txt",
|
||||
"cd /comfyui/custom_nodes/ComfyUI-Manager && mkdir startup-scripts",
|
||||
)
|
||||
.run_commands(f"cat /comfyui/server.py")
|
||||
.run_commands(f"ls /comfyui/app")
|
||||
# .run_commands(
|
||||
# # Install comfy deploy
|
||||
# "cd /comfyui/custom_nodes && git clone https://github.com/BennyKok/comfyui-deploy.git",
|
||||
@ -77,8 +77,6 @@ if not deploy_test:
|
||||
.run_commands("python install_deps.py")
|
||||
)
|
||||
|
||||
print("built image")
|
||||
|
||||
# Time to wait between API check attempts in milliseconds
|
||||
COMFY_API_AVAILABLE_INTERVAL_MS = 50
|
||||
# Maximum number of API check attempts
|
||||
@ -158,8 +156,9 @@ image = Image.debian_slim()
|
||||
|
||||
target_image = image if deploy_test else dockerfile_image
|
||||
|
||||
|
||||
@stub.function(image=target_image, gpu=config["gpu"], volumes=volumes)
|
||||
@stub.function(image=target_image, gpu=config["gpu"]
|
||||
,volumes=volumes
|
||||
)
|
||||
def run(input: Input):
|
||||
import subprocess
|
||||
import time
|
||||
@ -168,6 +167,7 @@ def run(input: Input):
|
||||
|
||||
command = ["python", "main.py",
|
||||
"--disable-auto-launch", "--disable-metadata"]
|
||||
|
||||
server_process = subprocess.Popen(command, cwd="/comfyui")
|
||||
|
||||
check_server(
|
||||
@ -240,7 +240,9 @@ async def bar(request_input: RequestInput):
|
||||
# pass
|
||||
|
||||
|
||||
@stub.function(image=image, volumes=volumes)
|
||||
@stub.function(image=image
|
||||
,volumes=volumes
|
||||
)
|
||||
@asgi_app()
|
||||
def comfyui_api():
|
||||
return web_app
|
||||
@ -289,8 +291,8 @@ def spawn_comfyui_in_background():
|
||||
# Restrict to 1 container because we want to our ComfyUI session state
|
||||
# to be on a single container.
|
||||
concurrency_limit=1,
|
||||
volumes=volumes,
|
||||
timeout=10 * 60,
|
||||
volumes=volumes,
|
||||
)
|
||||
@asgi_app()
|
||||
def comfyui_app():
|
||||
|
Loading…
x
Reference in New Issue
Block a user