bizyengine 0.4.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. bizyengine/__init__.py +35 -0
  2. bizyengine/bizy_server/__init__.py +7 -0
  3. bizyengine/bizy_server/api_client.py +763 -0
  4. bizyengine/bizy_server/errno.py +122 -0
  5. bizyengine/bizy_server/error_handler.py +3 -0
  6. bizyengine/bizy_server/execution.py +55 -0
  7. bizyengine/bizy_server/resp.py +24 -0
  8. bizyengine/bizy_server/server.py +898 -0
  9. bizyengine/bizy_server/utils.py +93 -0
  10. bizyengine/bizyair_extras/__init__.py +24 -0
  11. bizyengine/bizyair_extras/nodes_advanced_refluxcontrol.py +62 -0
  12. bizyengine/bizyair_extras/nodes_cogview4.py +31 -0
  13. bizyengine/bizyair_extras/nodes_comfyui_detail_daemon.py +180 -0
  14. bizyengine/bizyair_extras/nodes_comfyui_instantid.py +164 -0
  15. bizyengine/bizyair_extras/nodes_comfyui_layerstyle_advance.py +141 -0
  16. bizyengine/bizyair_extras/nodes_comfyui_pulid_flux.py +88 -0
  17. bizyengine/bizyair_extras/nodes_controlnet.py +50 -0
  18. bizyengine/bizyair_extras/nodes_custom_sampler.py +130 -0
  19. bizyengine/bizyair_extras/nodes_dataset.py +99 -0
  20. bizyengine/bizyair_extras/nodes_differential_diffusion.py +16 -0
  21. bizyengine/bizyair_extras/nodes_flux.py +69 -0
  22. bizyengine/bizyair_extras/nodes_image_utils.py +93 -0
  23. bizyengine/bizyair_extras/nodes_ip2p.py +20 -0
  24. bizyengine/bizyair_extras/nodes_ipadapter_plus/__init__.py +1 -0
  25. bizyengine/bizyair_extras/nodes_ipadapter_plus/nodes_ipadapter_plus.py +1598 -0
  26. bizyengine/bizyair_extras/nodes_janus_pro.py +81 -0
  27. bizyengine/bizyair_extras/nodes_kolors_mz/__init__.py +86 -0
  28. bizyengine/bizyair_extras/nodes_model_advanced.py +62 -0
  29. bizyengine/bizyair_extras/nodes_sd3.py +52 -0
  30. bizyengine/bizyair_extras/nodes_segment_anything.py +256 -0
  31. bizyengine/bizyair_extras/nodes_segment_anything_utils.py +134 -0
  32. bizyengine/bizyair_extras/nodes_testing_utils.py +139 -0
  33. bizyengine/bizyair_extras/nodes_trellis.py +199 -0
  34. bizyengine/bizyair_extras/nodes_ultimatesdupscale.py +137 -0
  35. bizyengine/bizyair_extras/nodes_upscale_model.py +32 -0
  36. bizyengine/bizyair_extras/nodes_wan_video.py +49 -0
  37. bizyengine/bizyair_extras/oauth_callback/main.py +118 -0
  38. bizyengine/core/__init__.py +8 -0
  39. bizyengine/core/commands/__init__.py +1 -0
  40. bizyengine/core/commands/base.py +27 -0
  41. bizyengine/core/commands/invoker.py +4 -0
  42. bizyengine/core/commands/processors/model_hosting_processor.py +0 -0
  43. bizyengine/core/commands/processors/prompt_processor.py +123 -0
  44. bizyengine/core/commands/servers/model_server.py +0 -0
  45. bizyengine/core/commands/servers/prompt_server.py +234 -0
  46. bizyengine/core/common/__init__.py +8 -0
  47. bizyengine/core/common/caching.py +198 -0
  48. bizyengine/core/common/client.py +262 -0
  49. bizyengine/core/common/env_var.py +101 -0
  50. bizyengine/core/common/utils.py +93 -0
  51. bizyengine/core/configs/conf.py +112 -0
  52. bizyengine/core/configs/models.json +101 -0
  53. bizyengine/core/configs/models.yaml +329 -0
  54. bizyengine/core/data_types.py +20 -0
  55. bizyengine/core/image_utils.py +288 -0
  56. bizyengine/core/nodes_base.py +159 -0
  57. bizyengine/core/nodes_io.py +97 -0
  58. bizyengine/core/path_utils/__init__.py +9 -0
  59. bizyengine/core/path_utils/path_manager.py +276 -0
  60. bizyengine/core/path_utils/utils.py +34 -0
  61. bizyengine/misc/__init__.py +0 -0
  62. bizyengine/misc/auth.py +83 -0
  63. bizyengine/misc/llm.py +431 -0
  64. bizyengine/misc/mzkolors.py +93 -0
  65. bizyengine/misc/nodes.py +1208 -0
  66. bizyengine/misc/nodes_controlnet_aux.py +491 -0
  67. bizyengine/misc/nodes_controlnet_union_sdxl.py +171 -0
  68. bizyengine/misc/route_sam.py +60 -0
  69. bizyengine/misc/segment_anything.py +276 -0
  70. bizyengine/misc/supernode.py +182 -0
  71. bizyengine/misc/utils.py +218 -0
  72. bizyengine/version.txt +1 -0
  73. bizyengine-0.4.2.dist-info/METADATA +12 -0
  74. bizyengine-0.4.2.dist-info/RECORD +76 -0
  75. bizyengine-0.4.2.dist-info/WHEEL +5 -0
  76. bizyengine-0.4.2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,141 @@
1
+ from bizyengine.core import BizyAirBaseNode
2
+
3
+ # layerstyle advance
4
+ NODE_NAME = "SegmentAnythingUltra V2"
5
+ sam_model_dir_name = "sams"
6
+ sam_model_list = {
7
+ "sam_vit_h (2.56GB)": {
8
+ "model_url": "https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth"
9
+ },
10
+ # "sam_vit_l (1.25GB)": {
11
+ # "model_url": "https://dl.fbaipublicfiles.com/segment_anything/sam_vit_l_0b3195.pth"
12
+ # },
13
+ # "sam_vit_b (375MB)": {
14
+ # "model_url": "https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth"
15
+ # },
16
+ # "sam_hq_vit_h (2.57GB)": {
17
+ # "model_url": "https://huggingface.co/lkeab/hq-sam/resolve/main/sam_hq_vit_h.pth"
18
+ # },
19
+ # "sam_hq_vit_l (1.25GB)": {
20
+ # "model_url": "https://huggingface.co/lkeab/hq-sam/resolve/main/sam_hq_vit_l.pth"
21
+ # },
22
+ # "sam_hq_vit_b (379MB)": {
23
+ # "model_url": "https://huggingface.co/lkeab/hq-sam/resolve/main/sam_hq_vit_b.pth"
24
+ # },
25
+ # "mobile_sam(39MB)": {
26
+ # "model_url": "https://github.com/ChaoningZhang/MobileSAM/blob/master/weights/mobile_sam.pt"
27
+ # }
28
+ }
29
+
30
+ groundingdino_model_dir_name = "grounding-dino"
31
+ groundingdino_model_list = {
32
+ "GroundingDINO_SwinT_OGC (694MB)": {
33
+ "config_url": "https://huggingface.co/ShilongLiu/GroundingDINO/resolve/main/GroundingDINO_SwinT_OGC.cfg.py",
34
+ "model_url": "https://huggingface.co/ShilongLiu/GroundingDINO/resolve/main/groundingdino_swint_ogc.pth",
35
+ },
36
+ # "GroundingDINO_SwinB (938MB)": {
37
+ # "config_url": "https://huggingface.co/ShilongLiu/GroundingDINO/resolve/main/GroundingDINO_SwinB.cfg.py",
38
+ # "model_url": "https://huggingface.co/ShilongLiu/GroundingDINO/resolve/main/groundingdino_swinb_cogcoor.pth"
39
+ # },
40
+ }
41
+
42
+
43
+ def list_sam_model():
44
+ return list(sam_model_list.keys())
45
+
46
+
47
+ def list_groundingdino_model():
48
+ return list(groundingdino_model_list.keys())
49
+
50
+
51
+ class SegmentAnythingUltraV2(BizyAirBaseNode):
52
+
53
+ CLASS_TYPE_NAME = "LayerMask: SegmentAnythingUltra V2"
54
+ NODE_DISPLAY_NAME = "LayerMask: SegmentAnythingUltra V2(Advance)"
55
+
56
+ def __init__(self):
57
+ self.SAM_MODEL = None
58
+ self.DINO_MODEL = None
59
+ self.previous_sam_model = ""
60
+ self.previous_dino_model = ""
61
+ pass
62
+
63
+ @classmethod
64
+ def INPUT_TYPES(cls):
65
+
66
+ method_list = [
67
+ "VITMatte",
68
+ "VITMatte(local)",
69
+ "PyMatting",
70
+ "GuidedFilter",
71
+ ]
72
+ device_list = ["cuda"]
73
+ return {
74
+ "required": {
75
+ "image": ("IMAGE",),
76
+ "sam_model": (list_sam_model(),),
77
+ "grounding_dino_model": (list_groundingdino_model(),),
78
+ "threshold": (
79
+ "FLOAT",
80
+ {"default": 0.3, "min": 0, "max": 1.0, "step": 0.01},
81
+ ),
82
+ "detail_method": (method_list,),
83
+ "detail_erode": (
84
+ "INT",
85
+ {"default": 6, "min": 1, "max": 255, "step": 1},
86
+ ),
87
+ "detail_dilate": (
88
+ "INT",
89
+ {"default": 6, "min": 1, "max": 255, "step": 1},
90
+ ),
91
+ "black_point": (
92
+ "FLOAT",
93
+ {
94
+ "default": 0.15,
95
+ "min": 0.01,
96
+ "max": 0.98,
97
+ "step": 0.01,
98
+ "display": "slider",
99
+ },
100
+ ),
101
+ "white_point": (
102
+ "FLOAT",
103
+ {
104
+ "default": 0.99,
105
+ "min": 0.02,
106
+ "max": 0.99,
107
+ "step": 0.01,
108
+ "display": "slider",
109
+ },
110
+ ),
111
+ "process_detail": ("BOOLEAN", {"default": True}),
112
+ "prompt": ("STRING", {"default": "subject"}),
113
+ "device": (device_list,),
114
+ "max_megapixels": (
115
+ "FLOAT",
116
+ {"default": 2.0, "min": 1, "max": 999, "step": 0.1},
117
+ ),
118
+ "cache_model": ("BOOLEAN", {"default": True}),
119
+ },
120
+ "optional": {},
121
+ }
122
+
123
+ RETURN_TYPES = (
124
+ "IMAGE",
125
+ "MASK",
126
+ )
127
+ RETURN_NAMES = (
128
+ "image",
129
+ "mask",
130
+ )
131
+ # FUNCTION = "segment_anything_ultra_v2"
132
+ CATEGORY = "😺dzNodes/LayerMask"
133
+
134
+
135
+ NODE_CLASS_MAPPINGS = {
136
+ "LayerMask: SegmentAnythingUltra V2": SegmentAnythingUltraV2,
137
+ }
138
+
139
+ NODE_DISPLAY_NAME_MAPPINGS = {
140
+ "LayerMask: SegmentAnythingUltra V2": "LayerMask: SegmentAnythingUltra V2(Advance)",
141
+ }
@@ -0,0 +1,88 @@
1
+ from bizyengine.core import BizyAirBaseNode, data_types
2
+ from bizyengine.core.path_utils import path_manager as folder_paths
3
+
4
+ # PuLID Flux datatypes
5
+ PULIDFLUX = "BIZYAIR_PULIDFLUX"
6
+ EVA_CLIP = "BIZYAIR_EVA_CLIP"
7
+ FACEANALYSIS = "BIZYAIR_FACEANALYSIS"
8
+
9
+
10
+ class PulidFluxModelLoader(BizyAirBaseNode):
11
+ @classmethod
12
+ def INPUT_TYPES(s):
13
+ return {"required": {"pulid_file": (folder_paths.get_filename_list("pulid"),)}}
14
+
15
+ RETURN_TYPES = (PULIDFLUX,)
16
+ RETURN_NAMES = ("pulid_flux",)
17
+ # FUNCTION = "load_model"
18
+ CATEGORY = "pulid"
19
+ NODE_DISPLAY_NAME = "Load PuLID Flux Model"
20
+
21
+
22
+ class PulidFluxInsightFaceLoader(BizyAirBaseNode):
23
+ @classmethod
24
+ def INPUT_TYPES(s):
25
+ return {
26
+ "required": {
27
+ "provider": (
28
+ [
29
+ "CUDA",
30
+ ],
31
+ ),
32
+ },
33
+ }
34
+
35
+ RETURN_TYPES = (FACEANALYSIS,)
36
+ RETURN_NAMES = ("face_analysis",)
37
+ # FUNCTION = "load_insightface"
38
+ CATEGORY = "pulid"
39
+ NODE_DISPLAY_NAME = "Load InsightFace (PuLID Flux)"
40
+
41
+
42
+ class PulidFluxEvaClipLoader(BizyAirBaseNode):
43
+ @classmethod
44
+ def INPUT_TYPES(s):
45
+ return {
46
+ "required": {},
47
+ }
48
+
49
+ RETURN_TYPES = (EVA_CLIP,)
50
+ RETURN_NAMES = ("eva_clip",)
51
+ # FUNCTION = "load_eva_clip"
52
+ CATEGORY = "pulid"
53
+ NODE_DISPLAY_NAME = "Load Eva Clip (PuLID Flux)"
54
+
55
+
56
+ class ApplyPulidFlux(BizyAirBaseNode):
57
+ @classmethod
58
+ def INPUT_TYPES(s):
59
+ return {
60
+ "required": {
61
+ "model": (data_types.MODEL,),
62
+ "pulid_flux": (PULIDFLUX,),
63
+ "eva_clip": (EVA_CLIP,),
64
+ "face_analysis": (FACEANALYSIS,),
65
+ "image": ("IMAGE",),
66
+ "weight": (
67
+ "FLOAT",
68
+ {"default": 1.0, "min": -1.0, "max": 5.0, "step": 0.05},
69
+ ),
70
+ "start_at": (
71
+ "FLOAT",
72
+ {"default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001},
73
+ ),
74
+ "end_at": (
75
+ "FLOAT",
76
+ {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001},
77
+ ),
78
+ },
79
+ "optional": {
80
+ "attn_mask": ("MASK",),
81
+ },
82
+ "hidden": {"unique_id": "UNIQUE_ID"},
83
+ }
84
+
85
+ RETURN_TYPES = (data_types.MODEL,)
86
+ # FUNCTION = "apply_pulid_flux"
87
+ CATEGORY = "pulid"
88
+ NODE_DISPLAY_NAME = "Apply PuLID Flux"
@@ -0,0 +1,50 @@
1
+ from bizyengine.core import BizyAirBaseNode, data_types
2
+ from comfy.cldm.control_types import UNION_CONTROLNET_TYPES
3
+
4
+
5
+ class SetUnionControlNetType(BizyAirBaseNode):
6
+ @classmethod
7
+ def INPUT_TYPES(s):
8
+ return {
9
+ "required": {
10
+ "control_net": (data_types.CONTROL_NET,),
11
+ "type": (["auto"] + list(UNION_CONTROLNET_TYPES.keys()),),
12
+ }
13
+ }
14
+
15
+ CATEGORY = "conditioning/controlnet"
16
+ RETURN_TYPES = (data_types.CONTROL_NET,)
17
+
18
+ # FUNCTION = "set_controlnet_type"
19
+
20
+
21
+ class ControlNetInpaintingAliMamaApply(BizyAirBaseNode):
22
+ @classmethod
23
+ def INPUT_TYPES(s):
24
+ return {
25
+ "required": {
26
+ "positive": (data_types.CONDITIONING,),
27
+ "negative": (data_types.CONDITIONING,),
28
+ "control_net": (data_types.CONTROL_NET,),
29
+ "vae": (data_types.VAE,),
30
+ "image": ("IMAGE",),
31
+ "mask": ("MASK",),
32
+ "strength": (
33
+ "FLOAT",
34
+ {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.01},
35
+ ),
36
+ "start_percent": (
37
+ "FLOAT",
38
+ {"default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001},
39
+ ),
40
+ "end_percent": (
41
+ "FLOAT",
42
+ {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001},
43
+ ),
44
+ }
45
+ }
46
+
47
+ # FUNCTION = "apply_inpaint_controlnet"
48
+ CATEGORY = "conditioning/controlnet"
49
+ RETURN_TYPES = (data_types.CONDITIONING, data_types.CONDITIONING)
50
+ RETURN_NAMES = ("positive", "negative")
@@ -0,0 +1,130 @@
1
+ from bizyengine.core import BizyAirBaseNode, data_types
2
+
3
+
4
+ class DisableNoise(BizyAirBaseNode):
5
+ @classmethod
6
+ def INPUT_TYPES(s):
7
+ return {"required": {}}
8
+
9
+ RETURN_TYPES = ("NOISE",)
10
+ CATEGORY = "sampling/custom_sampling/noise"
11
+
12
+
13
+ class VPScheduler(BizyAirBaseNode):
14
+ @classmethod
15
+ def INPUT_TYPES(s):
16
+ return {
17
+ "required": {
18
+ "steps": ("INT", {"default": 20, "min": 1, "max": 10000}),
19
+ "beta_d": (
20
+ "FLOAT",
21
+ {
22
+ "default": 19.9,
23
+ "min": 0.0,
24
+ "max": 5000.0,
25
+ "step": 0.01,
26
+ "round": False,
27
+ },
28
+ ), # TODO: fix default values
29
+ "beta_min": (
30
+ "FLOAT",
31
+ {
32
+ "default": 0.1,
33
+ "min": 0.0,
34
+ "max": 5000.0,
35
+ "step": 0.01,
36
+ "round": False,
37
+ },
38
+ ),
39
+ "eps_s": (
40
+ "FLOAT",
41
+ {
42
+ "default": 0.001,
43
+ "min": 0.0,
44
+ "max": 1.0,
45
+ "step": 0.0001,
46
+ "round": False,
47
+ },
48
+ ),
49
+ }
50
+ }
51
+
52
+ RETURN_TYPES = ("SIGMAS",)
53
+ CATEGORY = "sampling/custom_sampling/schedulers"
54
+
55
+
56
+ class SplitSigmas(BizyAirBaseNode):
57
+ @classmethod
58
+ def INPUT_TYPES(s):
59
+ return {
60
+ "required": {
61
+ "sigmas": ("SIGMAS",),
62
+ "step": ("INT", {"default": 0, "min": 0, "max": 10000}),
63
+ }
64
+ }
65
+
66
+ RETURN_TYPES = ("SIGMAS", "SIGMAS")
67
+ RETURN_NAMES = ("high_sigmas", "low_sigmas")
68
+ CATEGORY = "sampling/custom_sampling/sigmas"
69
+
70
+
71
+ class SplitSigmasDenoise(BizyAirBaseNode):
72
+ @classmethod
73
+ def INPUT_TYPES(s):
74
+ return {
75
+ "required": {
76
+ "sigmas": ("SIGMAS",),
77
+ "denoise": (
78
+ "FLOAT",
79
+ {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01},
80
+ ),
81
+ }
82
+ }
83
+
84
+ RETURN_TYPES = ("SIGMAS", "SIGMAS")
85
+ RETURN_NAMES = ("high_sigmas", "low_sigmas")
86
+ CATEGORY = "sampling/custom_sampling/sigmas"
87
+
88
+ # FUNCTION = "get_sigmas"
89
+
90
+
91
+ class FlipSigmas(BizyAirBaseNode):
92
+ @classmethod
93
+ def INPUT_TYPES(s):
94
+ return {
95
+ "required": {
96
+ "sigmas": ("SIGMAS",),
97
+ }
98
+ }
99
+
100
+ RETURN_TYPES = ("SIGMAS",)
101
+ CATEGORY = "sampling/custom_sampling/sigmas"
102
+
103
+ # FUNCTION = "get_sigmas"
104
+
105
+
106
+ class CFGGuider(BizyAirBaseNode):
107
+ @classmethod
108
+ def INPUT_TYPES(s):
109
+ return {
110
+ "required": {
111
+ "model": (data_types.MODEL,),
112
+ "positive": (data_types.CONDITIONING,),
113
+ "negative": (data_types.CONDITIONING,),
114
+ "cfg": (
115
+ "FLOAT",
116
+ {
117
+ "default": 8.0,
118
+ "min": 0.0,
119
+ "max": 100.0,
120
+ "step": 0.1,
121
+ "round": 0.01,
122
+ },
123
+ ),
124
+ }
125
+ }
126
+
127
+ RETURN_TYPES = ("GUIDER",)
128
+
129
+ # FUNCTION = "get_guider"
130
+ CATEGORY = "sampling/custom_sampling/guiders"
@@ -0,0 +1,99 @@
1
+ from bizyengine.core import BizyAirBaseNode
2
+
3
+
4
+ class TrainDatasetAdd(BizyAirBaseNode):
5
+ @classmethod
6
+ def INPUT_TYPES(s):
7
+ return {
8
+ "required": {
9
+ "dataset_config": ("JSON",),
10
+ "width": (
11
+ "INT",
12
+ {"min": 64, "default": 1024, "tooltip": "base resolution width"},
13
+ ),
14
+ "height": (
15
+ "INT",
16
+ {"min": 64, "default": 1024, "tooltip": "base resolution height"},
17
+ ),
18
+ "batch_size": (
19
+ "INT",
20
+ {
21
+ "min": 1,
22
+ "default": 2,
23
+ "tooltip": "Higher batch size uses more memory and generalizes the training more",
24
+ },
25
+ ),
26
+ "dataset_path": (
27
+ [
28
+ "to choose",
29
+ ],
30
+ # "STRING",
31
+ # {
32
+ # "multiline": True,
33
+ # "default": "",
34
+ # "tooltip": "path to dataset, root is the 'ComfyUI' folder, with windows portable 'ComfyUI_windows_portable'",
35
+ # },
36
+ ),
37
+ "dataset_version_id": (
38
+ "STRING",
39
+ {
40
+ "default": "",
41
+ },
42
+ ),
43
+ "class_tokens": (
44
+ "STRING",
45
+ {
46
+ "multiline": False,
47
+ "default": "trigger_word",
48
+ "tooltip": "aka trigger word, if specified, will be added to the start of each caption, if no captions exist, will be used on it's own",
49
+ },
50
+ ),
51
+ "enable_bucket": (
52
+ "BOOLEAN",
53
+ {
54
+ "default": True,
55
+ "tooltip": "enable buckets for multi aspect ratio training",
56
+ },
57
+ ),
58
+ "bucket_no_upscale": (
59
+ "BOOLEAN",
60
+ {
61
+ "default": False,
62
+ "tooltip": "don't allow upscaling when bucketing",
63
+ },
64
+ ),
65
+ "num_repeats": (
66
+ "INT",
67
+ {
68
+ "default": 1,
69
+ "min": 1,
70
+ "tooltip": "number of times to repeat dataset for an epoch",
71
+ },
72
+ ),
73
+ "min_bucket_reso": (
74
+ "INT",
75
+ {
76
+ "default": 256,
77
+ "min": 64,
78
+ "max": 4096,
79
+ "step": 8,
80
+ "tooltip": "min bucket resolution",
81
+ },
82
+ ),
83
+ "max_bucket_reso": (
84
+ "INT",
85
+ {
86
+ "default": 1024,
87
+ "min": 64,
88
+ "max": 4096,
89
+ "step": 8,
90
+ "tooltip": "max bucket resolution",
91
+ },
92
+ ),
93
+ },
94
+ }
95
+
96
+ RETURN_TYPES = ("JSON",)
97
+ RETURN_NAMES = ("dataset",)
98
+ # FUNCTION = "create_config"
99
+ CATEGORY = "FluxTrainer"
@@ -0,0 +1,16 @@
1
+ from bizyengine.core import BizyAirBaseNode, data_types
2
+
3
+
4
+ class DifferentialDiffusion(BizyAirBaseNode):
5
+ @classmethod
6
+ def INPUT_TYPES(s):
7
+ return {
8
+ "required": {
9
+ "model": (data_types.MODEL,),
10
+ }
11
+ }
12
+
13
+ RETURN_TYPES = (data_types.MODEL,)
14
+ # FUNCTION = "apply"
15
+ CATEGORY = "_for_testing"
16
+ INIT = False
@@ -0,0 +1,69 @@
1
+ from bizyengine.core import BizyAirBaseNode, data_types
2
+ from bizyengine.core.nodes_io import BizyAirNodeIO
3
+
4
+
5
+ class CLIPTextEncodeFlux(BizyAirBaseNode):
6
+ @classmethod
7
+ def INPUT_TYPES(s):
8
+ return {
9
+ "required": {
10
+ "clip": (data_types.CLIP,),
11
+ "clip_l": ("STRING", {"multiline": True, "dynamicPrompts": True}),
12
+ "t5xxl": ("STRING", {"multiline": True, "dynamicPrompts": True}),
13
+ "guidance": (
14
+ "FLOAT",
15
+ {"default": 3.5, "min": 0.0, "max": 100.0, "step": 0.1},
16
+ ),
17
+ }
18
+ }
19
+
20
+ RETURN_TYPES = (data_types.CONDITIONING,)
21
+ RETURN_NAMES = ("conditioning",)
22
+ # FUNCTION = "encode"
23
+
24
+ CATEGORY = "advanced/conditioning/flux"
25
+
26
+ # def encode(self, clip: BizyAirNodeIO, clip_l: str, t5xxl: str, guidance: float):
27
+ # new_clip = clip.copy(self.assigned_id)
28
+ # new_clip.add_node_data(
29
+ # class_type="CLIPTextEncodeFlux",
30
+ # inputs={
31
+ # "clip": clip,
32
+ # "clip_l": clip_l,
33
+ # "t5xxl": t5xxl,
34
+ # "guidance": guidance,
35
+ # },
36
+ # outputs={"slot_index": 0},
37
+ # )
38
+ # return (new_clip,)
39
+
40
+
41
+ class FluxGuidance(BizyAirBaseNode):
42
+ @classmethod
43
+ def INPUT_TYPES(s):
44
+ return {
45
+ "required": {
46
+ "conditioning": (data_types.CONDITIONING,),
47
+ "guidance": (
48
+ "FLOAT",
49
+ {"default": 3.5, "min": 0.0, "max": 100.0, "step": 0.1},
50
+ ),
51
+ }
52
+ }
53
+
54
+ RETURN_TYPES = (data_types.CONDITIONING,)
55
+ FUNCTION = "append"
56
+
57
+ CATEGORY = "advanced/conditioning/flux"
58
+
59
+ def append(self, conditioning: BizyAirNodeIO, guidance):
60
+ new_conditioning = conditioning.copy(self.assigned_id)
61
+ new_conditioning.add_node_data(
62
+ class_type="FluxGuidance",
63
+ inputs={
64
+ "conditioning": conditioning,
65
+ "guidance": guidance,
66
+ },
67
+ outputs={"slot_index": 0},
68
+ )
69
+ return (new_conditioning,)
@@ -0,0 +1,93 @@
1
+ import base64
2
+ import hashlib
3
+ import os
4
+ import re
5
+ import urllib.request
6
+
7
+ import folder_paths
8
+ from bizyengine.core import BizyAirBaseNode
9
+ from bizyengine.core.image_utils import encode_data
10
+ from nodes import LoadImage
11
+
12
+
13
+ class LoadImageURL(BizyAirBaseNode):
14
+ @classmethod
15
+ def INPUT_TYPES(s):
16
+ return {
17
+ "required": {
18
+ "url": (
19
+ "STRING",
20
+ {
21
+ "multiline": True, # True if you want the field to look like the one on the ClipTextEncode node
22
+ "default": "url or path",
23
+ "lazy": True,
24
+ },
25
+ ),
26
+ },
27
+ }
28
+
29
+ CATEGORY = "image_utils"
30
+ RETURN_TYPES = ("IMAGE", "MASK")
31
+ FUNCTION = "apply"
32
+ NODE_DISPLAY_NAME = "Load Image (URL)"
33
+
34
+ def apply(self, url: str):
35
+ url = url.strip()
36
+ input_dir = folder_paths.get_input_directory()
37
+
38
+ # check if it's a base64 encoded image
39
+ base64_pattern = r"^data:image/([a-zA-Z]+);base64,"
40
+ match = re.match(base64_pattern, url)
41
+
42
+ if match:
43
+ # get image format
44
+ image_format = match.group(1)
45
+ image_data = url.split(",")[1]
46
+
47
+ # calculate hash of the base64 data
48
+ hash_object = hashlib.md5(image_data.encode())
49
+ hash_value = hash_object.hexdigest()
50
+
51
+ filename = f"base64-{hash_value}.{image_format}"
52
+ file_path = os.path.join(input_dir, filename)
53
+
54
+ if not os.path.exists(file_path):
55
+ with open(file_path, "wb") as f:
56
+ f.write(base64.b64decode(image_data))
57
+ print(f"Base64 image saved as {filename}")
58
+ else:
59
+ print(f"Base64 image {filename} already exists, skipping save.")
60
+ else:
61
+ filename = os.path.basename(url)
62
+ file_path = os.path.join(input_dir, filename)
63
+
64
+ if os.path.exists(file_path):
65
+ print(f"File {filename} already exists, skipping download.")
66
+ else:
67
+ urllib.request.urlretrieve(url, file_path)
68
+ print(f"Image successfully downloaded and saved as {filename}.")
69
+
70
+ return LoadImage().load_image(filename)
71
+
72
+
73
+ class Image_Encode(BizyAirBaseNode):
74
+ @classmethod
75
+ def INPUT_TYPES(s):
76
+ return {
77
+ "required": {"image": ("IMAGE",)},
78
+ "optional": {
79
+ "lossless": (
80
+ "BOOLEAN",
81
+ {"default": False, "label_on": "yes", "label_off": "no"},
82
+ ),
83
+ },
84
+ }
85
+
86
+ CATEGORY = "image_utils"
87
+ FUNCTION = "apply"
88
+ RETURN_TYPES = ("IMAGE",)
89
+ NODE_DISPLAY_NAME = "Image Encode"
90
+
91
+ def apply(self, image, lossless=False):
92
+ out = encode_data(image, lossless=lossless)
93
+ return (out,)