Skip to content

Commit

Permalink
Improve cold start time (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
punitda authored Aug 11, 2024
1 parent 74c1fff commit 13df7b7
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions backend/src/template/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,16 @@ def download(self):
unzip_insight_face_models()
if downloaded:
models_volume.commit()

@enter()
def copy_models(self):
# Copy models from Volume to models directory
shutil.copytree(
MODELS_PATH, "/root/comfy/ComfyUI/models", dirs_exist_ok=True)
print(
"Copying models to correct directory - This might take a few more seconds")
shutil.copytree(
MODELS_PATH, "/root/comfy/ComfyUI/models", dirs_exist_ok=True)
print("Models copied!!")

def _run_comfyui_server(self, port=8188):
cmd = f"comfy --skip-prompt launch -- --listen 0.0.0.0 --port {port}"
subprocess.Popen(cmd, shell=True)

@web_server(8188, startup_timeout=30)
@web_server(8188, startup_timeout=60)
def ui(self):
self._run_comfyui_server()

0 comments on commit 13df7b7

Please sign in to comment.