Spaces:
Runtime error
Runtime error
Man-isH-07
commited on
Commit
Β·
7e6e4e8
1
Parent(s):
965759d
v1.5
Browse files- app.py +30 -15
- {utils β app_utils}/__init__.py +0 -0
- {utils β app_utils}/extra_config.py +0 -0
- {utils β app_utils}/json_util.py +0 -0
- main.py +3 -3
- object_remover.py +1 -1
- pap/custom_node_manager.py +1 -2
app.py
CHANGED
@@ -10,6 +10,11 @@ import sys
|
|
10 |
from comfy import model_management
|
11 |
from nodes import NODE_CLASS_MAPPINGS
|
12 |
|
|
|
|
|
|
|
|
|
|
|
13 |
print("Starting Space...")
|
14 |
|
15 |
os.makedirs('models/ultralytics/bbox',exist_ok=True)
|
@@ -128,30 +133,40 @@ def add_comfyui_directory_to_sys_path() -> None:
|
|
128 |
|
129 |
print("Model paths added")
|
130 |
|
131 |
-
import
|
132 |
-
print("
|
133 |
-
print("
|
134 |
|
135 |
-
|
136 |
-
print("
|
|
|
|
|
137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
|
139 |
-
|
140 |
-
print("
|
141 |
-
print("
|
142 |
-
print("Utils directory contents:", os.listdir('utils') if os.path.exists('utils') else "utils not found")
|
143 |
-
print("Parent utils directory contents:", os.listdir('../utils') if os.path.exists('../utils') else "parent utils not found")
|
144 |
-
print("------------------")
|
145 |
|
146 |
print("Checking for utils in sys.modules:", 'utils' in sys.modules)
|
147 |
if 'utils' in sys.modules:
|
148 |
print("utils module location:", sys.modules['utils'])
|
149 |
print("Attempting to import utils manually...")
|
150 |
try:
|
151 |
-
import
|
152 |
-
print("utils imported successfully:",
|
153 |
-
print("utils.__path__:", getattr(
|
154 |
-
print("utils.json_util available:", hasattr(
|
155 |
except ImportError as e:
|
156 |
print("Failed to import utils:", e)
|
157 |
|
|
|
10 |
from comfy import model_management
|
11 |
from nodes import NODE_CLASS_MAPPINGS
|
12 |
|
13 |
+
import sys
|
14 |
+
# Ensure /home/user/app/ is searched before /home/user/app/comfy/
|
15 |
+
sys.path.insert(0, '/home/user/app')
|
16 |
+
print("Modified sys.path:", sys.path)
|
17 |
+
|
18 |
print("Starting Space...")
|
19 |
|
20 |
os.makedirs('models/ultralytics/bbox',exist_ok=True)
|
|
|
133 |
|
134 |
print("Model paths added")
|
135 |
|
136 |
+
import app_utils
|
137 |
+
print("app_utils package imported:", app_utils)
|
138 |
+
# print("app_utils.__path__:", app_utils.__path__)
|
139 |
|
140 |
+
# Update debug prints
|
141 |
+
print("App_utils directory contents:", os.listdir('app_utils') if os.path.exists('app_utils') else "app_utils not found")
|
142 |
+
print("Parent app_utils directory contents:", os.listdir('../app_utils') if os.path.exists('../app_utils') else "parent app_utils not found")
|
143 |
+
print("------------------")
|
144 |
|
145 |
+
print("Checking for app_utils in sys.modules:", 'app_utils' in sys.modules)
|
146 |
+
if 'app_utils' in sys.modules:
|
147 |
+
print("app_utils module location:", sys.modules['app_utils'])
|
148 |
+
print("Attempting to import app_utils manually...")
|
149 |
+
try:
|
150 |
+
import app_utils
|
151 |
+
print("app_utils imported successfully:", app_utils)
|
152 |
+
print("app_utils.__path__:", getattr(app_utils, '__path__', 'Not a package'))
|
153 |
+
print("app_utils.json_util available:", hasattr(app_utils, 'json_util'))
|
154 |
+
except ImportError as e:
|
155 |
+
print("Failed to import app_utils:", e)
|
156 |
|
157 |
+
# Later in the file, update the debug prints again
|
158 |
+
print("App_utils directory contents:", os.listdir('app_utils') if os.path.exists('app_utils') else "app_utils not found")
|
159 |
+
print("Parent app_utils directory contents:", os.listdir('../app_utils') if os.path.exists('../app_utils') else "parent app_utils not found")
|
|
|
|
|
|
|
160 |
|
161 |
print("Checking for utils in sys.modules:", 'utils' in sys.modules)
|
162 |
if 'utils' in sys.modules:
|
163 |
print("utils module location:", sys.modules['utils'])
|
164 |
print("Attempting to import utils manually...")
|
165 |
try:
|
166 |
+
import app_utils
|
167 |
+
print("utils imported successfully:", app_utils)
|
168 |
+
print("utils.__path__:", getattr(app_utils, '__path__', 'Not a package'))
|
169 |
+
print("utils.json_util available:", hasattr(app_utils, 'json_util'))
|
170 |
except ImportError as e:
|
171 |
print("Failed to import utils:", e)
|
172 |
|
{utils β app_utils}/__init__.py
RENAMED
File without changes
|
{utils β app_utils}/extra_config.py
RENAMED
File without changes
|
{utils β app_utils}/json_util.py
RENAMED
File without changes
|
main.py
CHANGED
@@ -8,7 +8,7 @@ import time
|
|
8 |
from comfy.cli_args import args
|
9 |
from pap.logger import setup_logger
|
10 |
import itertools
|
11 |
-
import
|
12 |
import logging
|
13 |
|
14 |
if __name__ == "__main__":
|
@@ -23,11 +23,11 @@ def apply_custom_paths():
|
|
23 |
# extra model paths
|
24 |
extra_model_paths_config_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "extra_model_paths.yaml")
|
25 |
if os.path.isfile(extra_model_paths_config_path):
|
26 |
-
|
27 |
|
28 |
if args.extra_model_paths_config:
|
29 |
for config_path in itertools.chain(*args.extra_model_paths_config):
|
30 |
-
|
31 |
|
32 |
# --output-directory, --input-directory, --user-directory
|
33 |
if args.output_directory:
|
|
|
8 |
from comfy.cli_args import args
|
9 |
from pap.logger import setup_logger
|
10 |
import itertools
|
11 |
+
import app_utils.extra_config
|
12 |
import logging
|
13 |
|
14 |
if __name__ == "__main__":
|
|
|
23 |
# extra model paths
|
24 |
extra_model_paths_config_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "extra_model_paths.yaml")
|
25 |
if os.path.isfile(extra_model_paths_config_path):
|
26 |
+
app_utils.extra_config.load_extra_path_config(extra_model_paths_config_path)
|
27 |
|
28 |
if args.extra_model_paths_config:
|
29 |
for config_path in itertools.chain(*args.extra_model_paths_config):
|
30 |
+
app_utils.extra_config.load_extra_path_config(config_path)
|
31 |
|
32 |
# --output-directory, --input-directory, --user-directory
|
33 |
if args.output_directory:
|
object_remover.py
CHANGED
@@ -75,7 +75,7 @@ def add_extra_model_paths() -> None:
|
|
75 |
print(
|
76 |
"Could not import load_extra_path_config from main.py. Looking in utils.extra_config instead."
|
77 |
)
|
78 |
-
from
|
79 |
|
80 |
extra_model_paths = find_path("extra_model_paths.yaml")
|
81 |
|
|
|
75 |
print(
|
76 |
"Could not import load_extra_path_config from main.py. Looking in utils.extra_config instead."
|
77 |
)
|
78 |
+
from app_utils.extra_config import load_extra_path_config
|
79 |
|
80 |
extra_model_paths = find_path("extra_model_paths.yaml")
|
81 |
|
pap/custom_node_manager.py
CHANGED
@@ -8,8 +8,7 @@ import json
|
|
8 |
import logging
|
9 |
from functools import lru_cache
|
10 |
|
11 |
-
from
|
12 |
-
|
13 |
|
14 |
# Extra locale files to load into main.json
|
15 |
EXTRA_LOCALE_FILES = [
|
|
|
8 |
import logging
|
9 |
from functools import lru_cache
|
10 |
|
11 |
+
from app_utils.json_util import merge_json_recursive
|
|
|
12 |
|
13 |
# Extra locale files to load into main.json
|
14 |
EXTRA_LOCALE_FILES = [
|