Merge pull request #9 from dimtoneff/add_extra_model_paths
Added a function to load the directories in the optional file: extra_model_paths.yaml
This commit is contained in:
@@ -11,10 +11,14 @@ from typing import Dict, List, Any, Callable, Tuple
|
||||
|
||||
import black
|
||||
|
||||
from utils import import_custom_nodes, add_comfyui_directory_to_sys_path, get_value_at_index
|
||||
|
||||
sys.path.append('../')
|
||||
|
||||
try:
|
||||
from utils import import_custom_nodes, find_path, add_comfyui_directory_to_sys_path, add_extra_model_paths, get_value_at_index
|
||||
except ImportError:
|
||||
sys.path.append('.')
|
||||
from utils import import_custom_nodes, find_path, add_comfyui_directory_to_sys_path, add_extra_model_paths, get_value_at_index
|
||||
|
||||
from nodes import NODE_CLASS_MAPPINGS
|
||||
|
||||
|
||||
@@ -307,11 +311,11 @@ class CodeGenerator:
|
||||
"""
|
||||
# Get the source code of the utils functions as a string
|
||||
func_strings = []
|
||||
for func in [add_comfyui_directory_to_sys_path, get_value_at_index]:
|
||||
for func in [find_path, add_comfyui_directory_to_sys_path, add_extra_model_paths, get_value_at_index]:
|
||||
func_strings.append(f'\n{inspect.getsource(func)}')
|
||||
# Define static import statements required for the script
|
||||
static_imports = ['import os', 'import random', 'import sys', 'from typing import Sequence, Mapping, Any, Union',
|
||||
'import torch'] + func_strings + ['\n\nadd_comfyui_directory_to_sys_path()']
|
||||
static_imports = ['import os', 'import random', 'from pathlib import Path', 'import sys', 'from typing import Sequence, Mapping, Any, Union',
|
||||
'import torch'] + func_strings + ['\n\nadd_comfyui_directory_to_sys_path()\nadd_extra_model_paths()\n']
|
||||
# Check if custom nodes should be included
|
||||
if custom_nodes:
|
||||
static_imports.append(f'\n{inspect.getsource(import_custom_nodes)}\n')
|
||||
|
||||
Reference in New Issue
Block a user