import os import subprocess import sys import threading root_path = os.path.dirname(__file__) parent_dir = os.path.dirname(root_path) sys.path.append(root_path) from .comfyui.nodes import * NODE_CLASS_MAPPINGS = { "FC_LoraMerge": FCLoraMerge, } NODE_DISPLAY_NAME_MAPPINGS = { "FC_LoraMerge": "FC LoraMerge", } __all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS'] install_model = ["python-slugify==8.0.1", "modelscope", "controlnet_aux==0.0.6", "onnxruntime==1.15.1", "mmcv==1.7.0", "mmdet==2.26.0", "mediapipe==0.10.3", "edge_tts"] def handle_stream(stream, prefix): for line in stream: print(prefix, line, end="") def run_script(cmd, cwd='.'): process = subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, bufsize=1) stdout_thread = threading.Thread(target=handle_stream, args=(process.stdout, "")) stderr_thread = threading.Thread(target=handle_stream, args=(process.stderr, "[!]")) stdout_thread.start() stderr_thread.start() stdout_thread.join() stderr_thread.join() return process.wait() if os.path.basename(parent_dir) == "custom_nodes": print("## installing facechain dependencies") for model in install_model: run_script([sys.executable, '-s', '-m', 'pip', 'install', '-q', model])