-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path__init__.py
More file actions
144 lines (125 loc) Β· 3.88 KB
/
__init__.py
File metadata and controls
144 lines (125 loc) Β· 3.88 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
"""
@author: LogicAI
@title: ComfyUI-MagicAI
@nickname: π§ LogicAI
"""
import os
import sys
# from .setup import setup_all
# setup_all() # ζ―欑ε―ε¨Comfyι½δΌζ§θ‘setup_all()οΌθΏζ ·ιεΈΈθζΆοΌζδ»₯注ιζ
current_path = os.path.abspath(os.path.dirname(__file__))
modules_path = os.path.join(current_path, "modules")
if os.path.isdir(modules_path):
sys.path.insert(0, modules_path)
from .modules.magicai.nodes.Composite import *
from .modules.magicai.nodes.Exec import *
from .modules.magicai.nodes.IO import *
from .modules.magicai.nodes.Operation import *
from .modules.magicai.nodes.String import *
from .modules.magicai.utils.mappings import *
# Category Composite
composite_mappings = [
(AlphaMatte, "π¨ AlphaMatte (MagicAI)", "π¨ Alpha Matte (MagicAI)"),
]
# Category Resize
resize_mappings = [
(ResizeToMatchSize, "π ResizeToMatchSize (MagicAI)", "π Resize To Match Size (MagicAI)"),
(
ResizeToMatchSizeWithUpscaler,
"π ResizeToMatchSizeWithUpscaler (MagicAI)",
"π Resize To Match Size With Upscaler (MagicAI)",
),
(MaskResizeToMatchSize, "π MaskResizeToMatchSize (MagicAI)", "π Mask Resize To Match Size (MagicAI)"),
(ResizeToExpectedSize, "π ResizeToExpectedSize (MagicAI)", "π Resize To Expected Size (MagicAI)"),
(
ResizeToExpectedSizeWithUpscaler,
"π ResizeToExpectedSizeWithUpscaler (MagicAI)",
"π Resize To Expected Size With Upscaler (MagicAI)",
),
(
MaskResizeToExpectedSize,
"π MaskResizeToExpectedSize (MagicAI)",
"π Mask Resize To Expected Size (MagicAI)",
),
]
# Category BizyAir
bizyair_mappings = [
(
Tile_ExpectedImageSize_MagicAI,
"βοΈ Tile_ExpectedImageSize_MagicAI",
"βοΈ Tile Expected Image Size (MagicAI)",
),
]
# Category Exec
exec_mappings = [
(
PythonExecutionNode,
"π PythonExecution (MagicAI)",
"π Python Execution (MagicAI)",
),
]
string_mappings = [
(
ExtractJSONFromTextNode,
"ππ ExtractJSONFromTextNode (MagicAI)",
"ππ Extract JSON From Text Node(MagicAI)",
),
(
GetValueFromJsonString,
"ππ GetValueFromJsonString (MagicAI)",
"ππ Get Value From Json String (MagicAI)",
),
(
JinjaTemplateRenderer,
"π JinjaTemplateRenderer (MagicAI)",
"π Jinja Template Renderer (MagicAI)",
),
(
JsonKeyValueInjector,
"ππ JsonKeyValueInjector (MagicAI)",
"ππ Json Key Value Injector (MagicAI)",
),
]
# Category IO
io_mappings = [
(TextBox, "βπ» TextBox (MagicAI)", "βπ» Text Box (MagicAI)"),
(MaskToPreviewImage, "πΉ PreviewMask (MagicAI)", "πΉ Preview Mask (MagicAI)"),
]
# Category Operation
operation_mappings = [
(
MaskSizeCalculator,
"πΉπ© Mask Size Calculator (MagicAI)",
"πΉπ© Mask Size Calculator (MagicAI)",
),
(
UniversalMaskConverter,
"π UniversalMaskConverter (MagicAI)",
"π Universal Mask Converter (MagicAI)",
),
(
ChromaKeyToMask,
"π¨πΉ ChromaKeyToMask (MagicAI)",
"π¨πΉ Chroma Key To Mask (MagicAI)",
),
(PasteByMask, "ππ² PasteByMask (MagicAI)", "ππ² Paste By Mask (MagicAI)"),
]
# Define mappings as a list of category mappings
mappings = [
composite_mappings,
resize_mappings,
bizyair_mappings,
io_mappings,
operation_mappings,
string_mappings,
exec_mappings,
]
# Combine all mappings into a single list
all_mappings = []
for category in mappings:
all_mappings.extend(category)
# Generate mappings and assign to variables
NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS = generate_mappings(all_mappings)
# web uiηθηΉεθ½
WEB_DIRECTORY = "./web"
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS"]