diff --git a/__init__.py b/__init__.py index c199ffb..cab5f2e 100644 --- a/__init__.py +++ b/__init__.py @@ -1,5 +1,6 @@ #from .nodes.SegGPT import segGPTNode from .nodes import SegformerNode,ImageCaptioningNode,ImageProcessingNode + NODE_CLASS_MAPPINGS = { **SegformerNode.NODE_CLASS_MAPPINGS, diff --git a/nodes/__init__.py b/nodes/__init__.py new file mode 100644 index 0000000..a51425c --- /dev/null +++ b/nodes/__init__.py @@ -0,0 +1,31 @@ +from importlib.util import find_spec +from os.path import exists +from subprocess import run + +is_portable = True if exists("python_embeded") else False + +def check_and_install_package(package_name: str, install_name: str = None) -> None: + if find_spec(package_name): + return + + print(f"/_\ Installing {package_name}") + + package = install_name if install_name else package_name + + if is_portable: + command = f".\\python_embeded\\python.exe -s -m pip install {package}" + else: + command = f"pip install {package}" + + process = run(command, shell=True, check=True, capture_output=True) + +print("/_\ Checking packages") + +check_and_install_package("transformers") +check_and_install_package("pillow") +check_and_install_package("matplotlib") +check_and_install_package("numpy") +check_and_install_package("scipy") +check_and_install_package("fastapi") +check_and_install_package("pytorch_lightning") +check_and_install_package("clip", "git+https://github.com/openai/CLIP.git") \ No newline at end of file