インストールコマンド

!apt -y install -qq aria2
!pip install -q torch==2.0.1+cu118 torchvision==0.15.2+cu118 torchaudio==2.0.2+cu118 torchtext==0.15.2 torchdata==0.6.1 --extra-index-url <https://download.pytorch.org/whl/cu118> -U
!pip install onnxruntime-gpu

%cd /content
!git clone <https://github.com/comfyanonymous/ComfyUI>

%cd /content/ComfyUI
!pip install -r requirements.txt

# ComfyUI Managerのインストール
%cd /content/ComfyUI/custom_nodes
!git clone <https://github.com/ltdrdata/ComfyUI-Manager.git>
!git clone <https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite.git>

# ---------------- comfyui-reactor-nodeの設定開始 ---------------------
%cd /content/ComfyUI/custom_nodes

!git clone <https://github.com/Gourieff/comfyui-reactor-node.git>

%cd comfyui-reactor-node
!pip install -r requirements.txt
!python install.py

%cd /content/ComfyUI/custom_nodes
# ---------------- comfyui-reactor-nodeの設定終了 ---------------------

!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

# スレッドの開始
threading.Thread(target=iframe_thread, daemon=True, args=(8188,)).start()

# ComfyUIの実行
!python main.py --dont-print-server

利用ファイル

materials.zip