forked from if-ai/ComfyUI-IF_MemoAvatar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
44 lines (34 loc) · 1.37 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#__init__.py
import os
import sys
from pathlib import Path
# Get the absolute path to the current directory and memo directory
CURRENT_DIR = Path(__file__).parent.absolute()
MEMO_DIR = CURRENT_DIR / "memo"
# Add both directories to Python path if they're not already there
if str(CURRENT_DIR) not in sys.path:
sys.path.insert(0, str(CURRENT_DIR))
if str(MEMO_DIR) not in sys.path:
sys.path.insert(0, str(MEMO_DIR))
# Create an empty __init__.py in memo directory if it doesn't exist
memo_init = MEMO_DIR / "__init__.py"
if not memo_init.exists():
memo_init.touch()
# Now import the components using absolute imports
from .memo_model_manager import MemoModelManager
from .IF_MemoAvatar import IF_MemoAvatar
from .IF_MemoCheckpointLoader import IF_MemoCheckpointLoader
NODE_CLASS_MAPPINGS = {
"IF_MemoAvatar": IF_MemoAvatar,
"IF_MemoCheckpointLoader": IF_MemoCheckpointLoader,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"IF_MemoAvatar": "IF MemoAvatar 🗣️",
"IF_MemoCheckpointLoader": "IF Memo Checkpoint Loader"
}
# Define web directory relative to this file
WEB_DIRECTORY = os.path.join(os.path.dirname(__file__), "web")
# Register server routes
def setup_js_web_routes(app):
setup_routes(app) # Add our custom routes
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "WEB_DIRECTORY", "setup_js_web_routes"]