インストールコマンド
!apt install python3.10-venv
%cd /content
!git clone <https://github.com/ComfyWorkflows/comfyui-launcher>
!wget <https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb>
!dpkg -i cloudflared-linux-amd64.deb
import subprocess
import threading
import time
import socket
def iframe_thread(port):
while True:
time.sleep(0.5)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
result = sock.connect_ex(('127.0.0.1', port))
if result == 0:
break
sock.close()
print("\\nComfyUI finished loading, trying to launch cloudflared (if it gets stuck here cloudflared is having issues)\\n")
p = subprocess.Popen(["cloudflared", "tunnel", "--url", f"<http://127.0.0.1>:{port}"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
for line in p.stderr:
l = line.decode()
if "trycloudflare.com " in l:
print("This is the URL to access ComfyUI:", l[l.find("http"):], end='')
%cd /content/comfyui-launcher/
!chmod +x run.sh
# スレッドの開始
threading.Thread(target=iframe_thread, daemon=True, args=(4000,)).start()
!./run.sh
起動コマンド
# スレッドの開始
threading.Thread(target=iframe_thread, daemon=True, args=(8188,)).start()
# ワークスペースの名前を設定する
workspace_name = "work01"
%cd /content/comfyui-launcher/server/projects/$workspace_name/comfyui
!/content/comfyui-launcher/server/projects/$workspace_name/venv/bin/python main.py --dont-print-server