vectorvein 0.1.80__py3-none-any.whl → 0.1.81__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.
- vectorvein/workflow/graph/edge.py +36 -0
- vectorvein/workflow/graph/node.py +82 -0
- vectorvein/workflow/graph/port.py +173 -0
- vectorvein/workflow/graph/workflow.py +87 -0
- vectorvein/workflow/nodes/__init__.py +136 -0
- vectorvein/workflow/nodes/audio_generation.py +154 -0
- vectorvein/workflow/nodes/control_flows.py +170 -0
- vectorvein/workflow/nodes/file_processing.py +106 -0
- vectorvein/workflow/nodes/image_generation.py +743 -0
- vectorvein/workflow/nodes/llms.py +802 -0
- vectorvein/workflow/nodes/media_editing.py +668 -0
- vectorvein/workflow/nodes/media_processing.py +478 -0
- vectorvein/workflow/nodes/output.py +357 -0
- vectorvein/workflow/nodes/relational_db.py +153 -0
- vectorvein/workflow/nodes/text_processing.py +218 -0
- vectorvein/workflow/nodes/tools.py +331 -0
- vectorvein/workflow/nodes/triggers.py +0 -0
- vectorvein/workflow/nodes/vector_db.py +156 -0
- vectorvein/workflow/nodes/video_generation.py +113 -0
- vectorvein/workflow/nodes/web_crawlers.py +157 -0
- vectorvein/workflow/utils/json_to_code.py +191 -0
- {vectorvein-0.1.80.dist-info → vectorvein-0.1.81.dist-info}/METADATA +1 -1
- {vectorvein-0.1.80.dist-info → vectorvein-0.1.81.dist-info}/RECORD +25 -4
- {vectorvein-0.1.80.dist-info → vectorvein-0.1.81.dist-info}/WHEEL +0 -0
- {vectorvein-0.1.80.dist-info → vectorvein-0.1.81.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,743 @@
|
|
1
|
+
from typing import Optional
|
2
|
+
|
3
|
+
from ..graph.node import Node
|
4
|
+
from ..graph.port import PortType, InputPort, OutputPort
|
5
|
+
|
6
|
+
|
7
|
+
class BackgroundGeneration(Node):
|
8
|
+
def __init__(self, id: Optional[str] = None):
|
9
|
+
super().__init__(
|
10
|
+
node_type="BackgroundGeneration",
|
11
|
+
category="image_generation",
|
12
|
+
task_name="image_generation.background_generation",
|
13
|
+
node_id=id,
|
14
|
+
ports={
|
15
|
+
"base_image_url": InputPort(
|
16
|
+
name="base_image_url",
|
17
|
+
port_type=PortType.FILE,
|
18
|
+
value=list(),
|
19
|
+
support_file_types=[".jpg", ".jpeg", ".png", ".webp"],
|
20
|
+
multiple=True,
|
21
|
+
),
|
22
|
+
"remove_background": InputPort(
|
23
|
+
name="remove_background",
|
24
|
+
port_type=PortType.CHECKBOX,
|
25
|
+
value=True,
|
26
|
+
),
|
27
|
+
"remove_background_method": InputPort(
|
28
|
+
name="remove_background_method",
|
29
|
+
port_type=PortType.SELECT,
|
30
|
+
value="accurate",
|
31
|
+
options=[
|
32
|
+
{"value": "fast", "label": "fast"},
|
33
|
+
{"value": "accurate", "label": "accurate"},
|
34
|
+
{"value": "portrait", "label": "portrait"},
|
35
|
+
],
|
36
|
+
condition="return fieldsData.remove_background.value",
|
37
|
+
),
|
38
|
+
"ref_image_url": InputPort(
|
39
|
+
name="ref_image_url",
|
40
|
+
port_type=PortType.FILE,
|
41
|
+
value=list(),
|
42
|
+
support_file_types=[".jpg", ".jpeg", ".png", ".webp"],
|
43
|
+
),
|
44
|
+
"ref_prompt": InputPort(
|
45
|
+
name="ref_prompt",
|
46
|
+
port_type=PortType.TEXTAREA,
|
47
|
+
value="",
|
48
|
+
max_length=200,
|
49
|
+
),
|
50
|
+
"image_title": InputPort(
|
51
|
+
name="title",
|
52
|
+
port_type=PortType.INPUT,
|
53
|
+
value="",
|
54
|
+
),
|
55
|
+
"image_sub_title": InputPort(
|
56
|
+
name="sub_title",
|
57
|
+
port_type=PortType.INPUT,
|
58
|
+
value="",
|
59
|
+
),
|
60
|
+
"n": InputPort(
|
61
|
+
name="n",
|
62
|
+
port_type=PortType.NUMBER,
|
63
|
+
value=1,
|
64
|
+
),
|
65
|
+
"noise_level": InputPort(
|
66
|
+
name="noise_level",
|
67
|
+
port_type=PortType.NUMBER,
|
68
|
+
value=300,
|
69
|
+
),
|
70
|
+
"ref_prompt_weight": InputPort(
|
71
|
+
name="ref_prompt_weight",
|
72
|
+
port_type=PortType.NUMBER,
|
73
|
+
value=0.5,
|
74
|
+
),
|
75
|
+
"scene_type": InputPort(
|
76
|
+
name="scene_type",
|
77
|
+
port_type=PortType.SELECT,
|
78
|
+
value="GENERAL",
|
79
|
+
options=[
|
80
|
+
{"value": "GENERAL", "label": "GENERAL"},
|
81
|
+
{"value": "ROOM", "label": "ROOM"},
|
82
|
+
{"value": "COSMETIC", "label": "COSMETIC"},
|
83
|
+
],
|
84
|
+
),
|
85
|
+
"output_type": InputPort(
|
86
|
+
name="output_type",
|
87
|
+
port_type=PortType.SELECT,
|
88
|
+
value="markdown",
|
89
|
+
options=[
|
90
|
+
{"value": "only_link", "label": "only_link"},
|
91
|
+
{"value": "markdown", "label": "markdown"},
|
92
|
+
{"value": "html", "label": "html"},
|
93
|
+
],
|
94
|
+
),
|
95
|
+
"output": OutputPort(),
|
96
|
+
},
|
97
|
+
)
|
98
|
+
|
99
|
+
|
100
|
+
class DallE(Node):
|
101
|
+
def __init__(self, id: Optional[str] = None):
|
102
|
+
super().__init__(
|
103
|
+
node_type="DallE",
|
104
|
+
category="image_generation",
|
105
|
+
task_name="image_generation.dall_e",
|
106
|
+
node_id=id,
|
107
|
+
ports={
|
108
|
+
"prompt": InputPort(
|
109
|
+
name="prompt",
|
110
|
+
port_type=PortType.TEXTAREA,
|
111
|
+
value="",
|
112
|
+
),
|
113
|
+
"model": InputPort(
|
114
|
+
name="model",
|
115
|
+
port_type=PortType.SELECT,
|
116
|
+
value="dall-e-3",
|
117
|
+
options=[
|
118
|
+
{"value": "dall-e-3", "label": "DALL·E 3"},
|
119
|
+
],
|
120
|
+
),
|
121
|
+
"size": InputPort(
|
122
|
+
name="size",
|
123
|
+
port_type=PortType.SELECT,
|
124
|
+
value="1024x1024",
|
125
|
+
options=[
|
126
|
+
{"value": "1024x1024", "label": "1024x1024"},
|
127
|
+
{"value": "1792x1024", "label": "1792x1024"},
|
128
|
+
{"value": "1024x1792", "label": "1024x1792"},
|
129
|
+
],
|
130
|
+
),
|
131
|
+
"quality": InputPort(
|
132
|
+
name="quality",
|
133
|
+
port_type=PortType.SELECT,
|
134
|
+
value="standard",
|
135
|
+
options=[
|
136
|
+
{"value": "standard", "label": "standard"},
|
137
|
+
{"value": "hd", "label": "hd"},
|
138
|
+
],
|
139
|
+
),
|
140
|
+
"style": InputPort(
|
141
|
+
name="style",
|
142
|
+
port_type=PortType.SELECT,
|
143
|
+
value="vivid",
|
144
|
+
options=[
|
145
|
+
{"value": "vivid", "label": "vivid"},
|
146
|
+
{"value": "natural", "label": "natural"},
|
147
|
+
],
|
148
|
+
),
|
149
|
+
"output_type": InputPort(
|
150
|
+
name="output_type",
|
151
|
+
port_type=PortType.SELECT,
|
152
|
+
value="markdown",
|
153
|
+
options=[
|
154
|
+
{"value": "only_link", "label": "only_link"},
|
155
|
+
{"value": "markdown", "label": "markdown"},
|
156
|
+
{"value": "html", "label": "html"},
|
157
|
+
],
|
158
|
+
),
|
159
|
+
"output": OutputPort(),
|
160
|
+
},
|
161
|
+
)
|
162
|
+
|
163
|
+
|
164
|
+
class Flux1(Node):
|
165
|
+
def __init__(self, id: Optional[str] = None):
|
166
|
+
super().__init__(
|
167
|
+
node_type="Flux1",
|
168
|
+
category="image_generation",
|
169
|
+
task_name="image_generation.flux1",
|
170
|
+
node_id=id,
|
171
|
+
ports={
|
172
|
+
"prompt": InputPort(
|
173
|
+
name="prompt",
|
174
|
+
port_type=PortType.TEXTAREA,
|
175
|
+
value="",
|
176
|
+
),
|
177
|
+
"model": InputPort(
|
178
|
+
name="model",
|
179
|
+
port_type=PortType.SELECT,
|
180
|
+
value="FLUX.1 [dev]",
|
181
|
+
options=[
|
182
|
+
{"value": "FLUX.1 [schnell]", "label": "FLUX.1 [schnell]"},
|
183
|
+
{"value": "FLUX.1 [dev]", "label": "FLUX.1 [dev]"},
|
184
|
+
{"value": "FLUX.1 [pro]", "label": "FLUX.1 [pro]"},
|
185
|
+
{"value": "FLUX.1 [pro] ultra", "label": "FLUX.1 [pro] ultra"},
|
186
|
+
],
|
187
|
+
),
|
188
|
+
"width": InputPort(
|
189
|
+
name="width",
|
190
|
+
port_type=PortType.NUMBER,
|
191
|
+
value=1024,
|
192
|
+
max=1536,
|
193
|
+
condition="return fieldsData.model.value !== 'FLUX.1 [pro] ultra'",
|
194
|
+
),
|
195
|
+
"height": InputPort(
|
196
|
+
name="height",
|
197
|
+
port_type=PortType.NUMBER,
|
198
|
+
value=1024,
|
199
|
+
max=1536,
|
200
|
+
condition="return fieldsData.model.value !== 'FLUX.1 [pro] ultra'",
|
201
|
+
),
|
202
|
+
"aspect_ratio": InputPort(
|
203
|
+
name="aspect_ratio",
|
204
|
+
port_type=PortType.SELECT,
|
205
|
+
value="16:9",
|
206
|
+
options=[
|
207
|
+
{"value": "21:9", "label": "21:9"},
|
208
|
+
{"value": "16:9", "label": "16:9"},
|
209
|
+
{"value": "4:3", "label": "4:3"},
|
210
|
+
{"value": "1:1", "label": "1:1"},
|
211
|
+
{"value": "3:4", "label": "3:4"},
|
212
|
+
{"value": "9:16", "label": "9:16"},
|
213
|
+
{"value": "9:21", "label": "9:21"},
|
214
|
+
],
|
215
|
+
condition="return fieldsData.model.value === 'FLUX.1 [pro] ultra'",
|
216
|
+
),
|
217
|
+
"raw": InputPort(
|
218
|
+
name="raw",
|
219
|
+
port_type=PortType.CHECKBOX,
|
220
|
+
value=False,
|
221
|
+
condition="return fieldsData.model.value === 'FLUX.1 [pro] ultra'",
|
222
|
+
),
|
223
|
+
"steps": InputPort(
|
224
|
+
name="steps",
|
225
|
+
port_type=PortType.NUMBER,
|
226
|
+
value=30,
|
227
|
+
),
|
228
|
+
"cfg_scale": InputPort(
|
229
|
+
name="cfg_scale",
|
230
|
+
port_type=PortType.NUMBER,
|
231
|
+
value=7,
|
232
|
+
),
|
233
|
+
"output_type": InputPort(
|
234
|
+
name="output_type",
|
235
|
+
port_type=PortType.SELECT,
|
236
|
+
value="markdown",
|
237
|
+
options=[
|
238
|
+
{"value": "only_link", "label": "only_link"},
|
239
|
+
{"value": "markdown", "label": "markdown"},
|
240
|
+
{"value": "html", "label": "html"},
|
241
|
+
],
|
242
|
+
),
|
243
|
+
"output": OutputPort(),
|
244
|
+
},
|
245
|
+
)
|
246
|
+
|
247
|
+
|
248
|
+
class Inpainting(Node):
|
249
|
+
def __init__(self, id: Optional[str] = None):
|
250
|
+
super().__init__(
|
251
|
+
node_type="Inpainting",
|
252
|
+
category="image_generation",
|
253
|
+
task_name="image_generation.inpainting",
|
254
|
+
node_id=id,
|
255
|
+
ports={
|
256
|
+
"input_image": InputPort(
|
257
|
+
name="input_image",
|
258
|
+
port_type=PortType.FILE,
|
259
|
+
value=list(),
|
260
|
+
support_file_types=[".jpg", ".jpeg", ".png", ".webp"],
|
261
|
+
),
|
262
|
+
"inpainting_method": InputPort(
|
263
|
+
name="inpainting_method",
|
264
|
+
port_type=PortType.SELECT,
|
265
|
+
value="smart",
|
266
|
+
options=[
|
267
|
+
{"value": "smart", "label": "smart"},
|
268
|
+
{"value": "custom", "label": "custom"},
|
269
|
+
],
|
270
|
+
),
|
271
|
+
"mask_image": InputPort(
|
272
|
+
name="mask_image",
|
273
|
+
port_type=PortType.FILE,
|
274
|
+
value=list(),
|
275
|
+
support_file_types=[".jpg", ".jpeg", ".png", ".webp"],
|
276
|
+
condition="return fieldsData.inpainting_method.value === 'custom'",
|
277
|
+
),
|
278
|
+
"prompt": InputPort(
|
279
|
+
name="prompt",
|
280
|
+
port_type=PortType.TEXTAREA,
|
281
|
+
value="",
|
282
|
+
),
|
283
|
+
"model": InputPort(
|
284
|
+
name="model",
|
285
|
+
port_type=PortType.SELECT,
|
286
|
+
value="FLUX.1 [pro] Fill",
|
287
|
+
options=[
|
288
|
+
{"value": "FLUX.1 [pro] Fill", "label": "FLUX.1 [pro] Fill"},
|
289
|
+
{"value": "FLUX.1 [dev] Fill", "label": "FLUX.1 [dev] Fill"},
|
290
|
+
{"value": "Stable Diffusion XL", "label": "Stable Diffusion XL"},
|
291
|
+
],
|
292
|
+
),
|
293
|
+
"output_type": InputPort(
|
294
|
+
name="output_type",
|
295
|
+
port_type=PortType.SELECT,
|
296
|
+
value="markdown",
|
297
|
+
options=[
|
298
|
+
{"value": "only_link", "label": "only_link"},
|
299
|
+
{"value": "markdown", "label": "markdown"},
|
300
|
+
{"value": "html", "label": "html"},
|
301
|
+
],
|
302
|
+
),
|
303
|
+
"output": OutputPort(),
|
304
|
+
"output_mask": OutputPort(
|
305
|
+
condition="return fieldsData.inpainting_method.value === 'smart'",
|
306
|
+
),
|
307
|
+
},
|
308
|
+
)
|
309
|
+
|
310
|
+
|
311
|
+
class Kolors(Node):
|
312
|
+
def __init__(self, id: Optional[str] = None):
|
313
|
+
super().__init__(
|
314
|
+
node_type="Kolors",
|
315
|
+
category="image_generation",
|
316
|
+
task_name="image_generation.kolors",
|
317
|
+
node_id=id,
|
318
|
+
ports={
|
319
|
+
"prompt": InputPort(
|
320
|
+
name="prompt",
|
321
|
+
port_type=PortType.TEXTAREA,
|
322
|
+
value="",
|
323
|
+
),
|
324
|
+
"negative_prompt": InputPort(
|
325
|
+
name="negative_prompt",
|
326
|
+
port_type=PortType.TEXTAREA,
|
327
|
+
value="",
|
328
|
+
),
|
329
|
+
"width": InputPort(
|
330
|
+
name="width",
|
331
|
+
port_type=PortType.NUMBER,
|
332
|
+
value=1024,
|
333
|
+
),
|
334
|
+
"height": InputPort(
|
335
|
+
name="height",
|
336
|
+
port_type=PortType.NUMBER,
|
337
|
+
value=1024,
|
338
|
+
),
|
339
|
+
"steps": InputPort(
|
340
|
+
name="steps",
|
341
|
+
port_type=PortType.NUMBER,
|
342
|
+
value=30,
|
343
|
+
),
|
344
|
+
"cfg_scale": InputPort(
|
345
|
+
name="cfg_scale",
|
346
|
+
port_type=PortType.NUMBER,
|
347
|
+
value=7,
|
348
|
+
),
|
349
|
+
"scheduler": InputPort(
|
350
|
+
name="scheduler",
|
351
|
+
port_type=PortType.SELECT,
|
352
|
+
value="EulerDiscreteScheduler",
|
353
|
+
options=[
|
354
|
+
{"value": "EulerDiscreteScheduler", "label": "EulerDiscreteScheduler"},
|
355
|
+
{"value": "EulerAncestralDiscreteScheduler", "label": "EulerAncestralDiscreteScheduler"},
|
356
|
+
{"value": "DPMSolverMultistepScheduler", "label": "DPMSolverMultistepScheduler"},
|
357
|
+
{
|
358
|
+
"value": "DPMSolverMultistepScheduler_SDE_karras",
|
359
|
+
"label": "DPMSolverMultistepScheduler_SDE_karras",
|
360
|
+
},
|
361
|
+
{"value": "UniPCMultistepScheduler", "label": "UniPCMultistepScheduler"},
|
362
|
+
{"value": "DEISMultistepScheduler", "label": "DEISMultistepScheduler"},
|
363
|
+
],
|
364
|
+
),
|
365
|
+
"output_type": InputPort(
|
366
|
+
name="output_type",
|
367
|
+
port_type=PortType.SELECT,
|
368
|
+
value="markdown",
|
369
|
+
options=[
|
370
|
+
{"value": "only_link", "label": "only_link"},
|
371
|
+
{"value": "markdown", "label": "markdown"},
|
372
|
+
{"value": "html", "label": "html"},
|
373
|
+
],
|
374
|
+
),
|
375
|
+
"output": OutputPort(),
|
376
|
+
},
|
377
|
+
)
|
378
|
+
|
379
|
+
|
380
|
+
class Pulid(Node):
|
381
|
+
def __init__(self, id: Optional[str] = None):
|
382
|
+
super().__init__(
|
383
|
+
node_type="Pulid",
|
384
|
+
category="image_generation",
|
385
|
+
task_name="image_generation.pulid",
|
386
|
+
node_id=id,
|
387
|
+
ports={
|
388
|
+
"reference_image": InputPort(
|
389
|
+
name="reference_image",
|
390
|
+
port_type=PortType.FILE,
|
391
|
+
value=list(),
|
392
|
+
support_file_types=[".jpg", ".jpeg", ".png", ".webp"],
|
393
|
+
),
|
394
|
+
"prompt": InputPort(
|
395
|
+
name="prompt",
|
396
|
+
port_type=PortType.TEXTAREA,
|
397
|
+
value="",
|
398
|
+
),
|
399
|
+
"negative_prompt": InputPort(
|
400
|
+
name="negative_prompt",
|
401
|
+
port_type=PortType.TEXTAREA,
|
402
|
+
value="bad quality, worst quality, text, signature, watermark, extra limbs",
|
403
|
+
),
|
404
|
+
"image_size": InputPort(
|
405
|
+
name="image_size",
|
406
|
+
port_type=PortType.SELECT,
|
407
|
+
value="landscape_4_3",
|
408
|
+
options=[
|
409
|
+
{"value": "square_hd", "label": "square_hd"},
|
410
|
+
{"value": "square", "label": "square"},
|
411
|
+
{"value": "portrait_4_3", "label": "portrait_4_3"},
|
412
|
+
{"value": "portrait_16_9", "label": "portrait_16_9"},
|
413
|
+
{"value": "landscape_4_3", "label": "landscape_4_3"},
|
414
|
+
{"value": "landscape_16_9", "label": "landscape_16_9"},
|
415
|
+
{"value": "custom", "label": "custom"},
|
416
|
+
],
|
417
|
+
),
|
418
|
+
"custom_width": InputPort(
|
419
|
+
name="custom_width",
|
420
|
+
port_type=PortType.NUMBER,
|
421
|
+
value=1024,
|
422
|
+
condition="return fieldsData.image_size.value === 'custom'",
|
423
|
+
),
|
424
|
+
"custom_height": InputPort(
|
425
|
+
name="custom_height",
|
426
|
+
port_type=PortType.NUMBER,
|
427
|
+
value=768,
|
428
|
+
condition="return fieldsData.image_size.value === 'custom'",
|
429
|
+
),
|
430
|
+
"num_inference_steps": InputPort(
|
431
|
+
name="num_inference_steps",
|
432
|
+
port_type=PortType.NUMBER,
|
433
|
+
value=20,
|
434
|
+
),
|
435
|
+
"seed": InputPort(
|
436
|
+
name="seed",
|
437
|
+
port_type=PortType.NUMBER,
|
438
|
+
value=-1,
|
439
|
+
),
|
440
|
+
"guidance_scale": InputPort(
|
441
|
+
name="guidance_scale",
|
442
|
+
port_type=PortType.NUMBER,
|
443
|
+
value=4,
|
444
|
+
),
|
445
|
+
"true_cfg": InputPort(
|
446
|
+
name="true_cfg",
|
447
|
+
port_type=PortType.NUMBER,
|
448
|
+
value=1,
|
449
|
+
),
|
450
|
+
"id_weight": InputPort(
|
451
|
+
name="id_weight",
|
452
|
+
port_type=PortType.NUMBER,
|
453
|
+
value=1,
|
454
|
+
),
|
455
|
+
"max_sequence_length": InputPort(
|
456
|
+
name="max_sequence_length",
|
457
|
+
port_type=PortType.SELECT,
|
458
|
+
value="256",
|
459
|
+
options=[
|
460
|
+
{"value": "128", "label": "128"},
|
461
|
+
{"value": "256", "label": "256"},
|
462
|
+
{"value": "512", "label": "512"},
|
463
|
+
],
|
464
|
+
),
|
465
|
+
"output_type": InputPort(
|
466
|
+
name="output_type",
|
467
|
+
port_type=PortType.SELECT,
|
468
|
+
value="markdown",
|
469
|
+
options=[
|
470
|
+
{"value": "only_link", "label": "only_link"},
|
471
|
+
{"value": "markdown", "label": "markdown"},
|
472
|
+
{"value": "html", "label": "html"},
|
473
|
+
],
|
474
|
+
),
|
475
|
+
"output": OutputPort(),
|
476
|
+
},
|
477
|
+
)
|
478
|
+
|
479
|
+
|
480
|
+
class Recraft(Node):
|
481
|
+
def __init__(self, id: Optional[str] = None):
|
482
|
+
super().__init__(
|
483
|
+
node_type="Recraft",
|
484
|
+
category="image_generation",
|
485
|
+
task_name="image_generation.recraft",
|
486
|
+
node_id=id,
|
487
|
+
ports={
|
488
|
+
"generation_type": InputPort(
|
489
|
+
name="generation_type",
|
490
|
+
port_type=PortType.SELECT,
|
491
|
+
value="text_to_image",
|
492
|
+
options=[
|
493
|
+
{"value": "text_to_image", "label": "text_to_image"},
|
494
|
+
{"value": "image_to_vector", "label": "image_to_vector"},
|
495
|
+
],
|
496
|
+
),
|
497
|
+
"image_url": InputPort(
|
498
|
+
name="image_url",
|
499
|
+
port_type=PortType.FILE,
|
500
|
+
value=list(),
|
501
|
+
support_file_types=[".jpg", ".jpeg", ".png", ".webp"],
|
502
|
+
multiple=False,
|
503
|
+
condition="return fieldsData.generation_type.value === 'image_to_vector'",
|
504
|
+
),
|
505
|
+
"prompt": InputPort(
|
506
|
+
name="prompt",
|
507
|
+
port_type=PortType.TEXTAREA,
|
508
|
+
value="",
|
509
|
+
condition="return fieldsData.generation_type.value === 'text_to_image'",
|
510
|
+
),
|
511
|
+
"base_style": InputPort(
|
512
|
+
name="base_style",
|
513
|
+
port_type=PortType.SELECT,
|
514
|
+
value="any",
|
515
|
+
options=[
|
516
|
+
{"value": "any", "label": "any"},
|
517
|
+
{"value": "realistic_image", "label": "realistic_image"},
|
518
|
+
{"value": "digital_illustration", "label": "digital_illustration"},
|
519
|
+
{"value": "vector_illustration", "label": "vector_illustration"},
|
520
|
+
],
|
521
|
+
condition="return fieldsData.generation_type.value === 'text_to_image'",
|
522
|
+
),
|
523
|
+
"substyle_realistic_image": InputPort(
|
524
|
+
name="substyle_realistic_image",
|
525
|
+
port_type=PortType.SELECT,
|
526
|
+
value="null",
|
527
|
+
options=[
|
528
|
+
{"value": "null", "label": "null"},
|
529
|
+
{"value": "b_and_w", "label": "b_and_w"},
|
530
|
+
{"value": "hard_flash", "label": "hard_flash"},
|
531
|
+
{"value": "hdr", "label": "hdr"},
|
532
|
+
{"value": "natural_light", "label": "natural_light"},
|
533
|
+
{"value": "studio_portrait", "label": "studio_portrait"},
|
534
|
+
{"value": "enterprise", "label": "enterprise"},
|
535
|
+
{"value": "motion_blur", "label": "motion_blur"},
|
536
|
+
],
|
537
|
+
condition="return fieldsData.generation_type.value === 'text_to_image' && fieldsData.base_style.value === 'realistic_image'",
|
538
|
+
),
|
539
|
+
"substyle_digital_illustration": InputPort(
|
540
|
+
name="substyle_digital_illustration",
|
541
|
+
port_type=PortType.SELECT,
|
542
|
+
value="null",
|
543
|
+
options=[
|
544
|
+
{"value": "null", "label": "null"},
|
545
|
+
{"value": "pixel_art", "label": "pixel_art"},
|
546
|
+
{"value": "hand_drawn", "label": "hand_drawn"},
|
547
|
+
{"value": "grain", "label": "grain"},
|
548
|
+
{"value": "infantile_sketch", "label": "infantile_sketch"},
|
549
|
+
{"value": "2d_art_poster", "label": "2d_art_poster"},
|
550
|
+
{"value": "handmade_3d", "label": "handmade_3d"},
|
551
|
+
{"value": "hand_drawn_outline", "label": "hand_drawn_outline"},
|
552
|
+
{"value": "engraving_color", "label": "engraving_color"},
|
553
|
+
{"value": "2d_art_poster_2", "label": "2d_art_poster_2"},
|
554
|
+
],
|
555
|
+
condition="return fieldsData.generation_type.value === 'text_to_image' && fieldsData.base_style.value === 'digital_illustration'",
|
556
|
+
),
|
557
|
+
"substyle_vector_illustration": InputPort(
|
558
|
+
name="substyle_vector_illustration",
|
559
|
+
port_type=PortType.SELECT,
|
560
|
+
value="null",
|
561
|
+
options=[
|
562
|
+
{"value": "null", "label": "null"},
|
563
|
+
{"value": "engraving", "label": "engraving"},
|
564
|
+
{"value": "line_art", "label": "line_art"},
|
565
|
+
{"value": "line_circuit", "label": "line_circuit"},
|
566
|
+
{"value": "linocut", "label": "linocut"},
|
567
|
+
],
|
568
|
+
condition="return fieldsData.generation_type.value === 'text_to_image' && fieldsData.base_style.value === 'vector_illustration'",
|
569
|
+
),
|
570
|
+
"size": InputPort(
|
571
|
+
name="size",
|
572
|
+
port_type=PortType.SELECT,
|
573
|
+
value="1024x1024",
|
574
|
+
options=[
|
575
|
+
{"value": "1024x1024", "label": "1024x1024"},
|
576
|
+
{"value": "1365x1024", "label": "1365x1024"},
|
577
|
+
{"value": "1024x1365", "label": "1024x1365"},
|
578
|
+
{"value": "1536x1024", "label": "1536x1024"},
|
579
|
+
{"value": "1024x1536", "label": "1024x1536"},
|
580
|
+
{"value": "1820x1024", "label": "1820x1024"},
|
581
|
+
{"value": "1024x1820", "label": "1024x1820"},
|
582
|
+
{"value": "1024x2048", "label": "1024x2048"},
|
583
|
+
{"value": "2048x1024", "label": "2048x1024"},
|
584
|
+
{"value": "1434x1024", "label": "1434x1024"},
|
585
|
+
{"value": "1024x1434", "label": "1024x1434"},
|
586
|
+
{"value": "1024x1280", "label": "1024x1280"},
|
587
|
+
{"value": "1280x1024", "label": "1280x1024"},
|
588
|
+
{"value": "1024x1707", "label": "1024x1707"},
|
589
|
+
{"value": "1707x1024", "label": "1707x1024"},
|
590
|
+
],
|
591
|
+
condition="return fieldsData.generation_type.value === 'text_to_image'",
|
592
|
+
),
|
593
|
+
"colors": InputPort(
|
594
|
+
name="colors",
|
595
|
+
port_type=PortType.COLOR,
|
596
|
+
value=list(),
|
597
|
+
multiple=True,
|
598
|
+
condition="return fieldsData.generation_type.value === 'text_to_image'",
|
599
|
+
),
|
600
|
+
"background_color": InputPort(
|
601
|
+
name="background_color",
|
602
|
+
port_type=PortType.COLOR,
|
603
|
+
value=list(),
|
604
|
+
multiple=True,
|
605
|
+
max_count=1,
|
606
|
+
condition="return fieldsData.generation_type.value === 'text_to_image'",
|
607
|
+
),
|
608
|
+
"output_type": InputPort(
|
609
|
+
name="output_type",
|
610
|
+
port_type=PortType.SELECT,
|
611
|
+
value="markdown",
|
612
|
+
options=[
|
613
|
+
{"value": "only_link", "label": "only_link"},
|
614
|
+
{"value": "markdown", "label": "markdown"},
|
615
|
+
{"value": "html", "label": "html"},
|
616
|
+
],
|
617
|
+
),
|
618
|
+
"output": OutputPort(),
|
619
|
+
},
|
620
|
+
)
|
621
|
+
|
622
|
+
|
623
|
+
class StableDiffusion(Node):
|
624
|
+
def __init__(self, id: Optional[str] = None):
|
625
|
+
special_width_height_models = [
|
626
|
+
"stable-diffusion-xl-1024-v0-9",
|
627
|
+
"stable-diffusion-xl-1024-v1-0",
|
628
|
+
]
|
629
|
+
sd3_models = [
|
630
|
+
"sd-ultra",
|
631
|
+
"sd3-large",
|
632
|
+
"sd3-large-turbo",
|
633
|
+
"sd3-medium",
|
634
|
+
"sd3.5-large",
|
635
|
+
"sd3.5-large-turbo",
|
636
|
+
"sd3.5-medium",
|
637
|
+
"sd-core",
|
638
|
+
]
|
639
|
+
|
640
|
+
super().__init__(
|
641
|
+
node_type="StableDiffusion",
|
642
|
+
category="image_generation",
|
643
|
+
task_name="image_generation.stable_diffusion",
|
644
|
+
node_id=id,
|
645
|
+
ports={
|
646
|
+
"prompt": InputPort(
|
647
|
+
name="prompt",
|
648
|
+
port_type=PortType.TEXTAREA,
|
649
|
+
value="",
|
650
|
+
),
|
651
|
+
"negative_prompt": InputPort(
|
652
|
+
name="negative_prompt",
|
653
|
+
port_type=PortType.TEXTAREA,
|
654
|
+
value="",
|
655
|
+
),
|
656
|
+
"model": InputPort(
|
657
|
+
name="model",
|
658
|
+
port_type=PortType.SELECT,
|
659
|
+
value="stable-diffusion-xl-1024-v1-0",
|
660
|
+
options=[
|
661
|
+
{"value": "sd-ultra", "label": "Ultra"},
|
662
|
+
{"value": "sd3.5-large", "label": "Stable Diffusion 3.5 Large"},
|
663
|
+
{"value": "sd3-large", "label": "Stable Diffusion 3 Large"},
|
664
|
+
{"value": "sd3.5-large-turbo", "label": "Stable Diffusion 3.5 Large Turbo"},
|
665
|
+
{"value": "sd3-large-turbo", "label": "Stable Diffusion 3 Large Turbo"},
|
666
|
+
{"value": "sd3.5-medium", "label": "Stable Diffusion 3.5 Medium"},
|
667
|
+
{"value": "sd3-medium", "label": "Stable Diffusion 3 Medium"},
|
668
|
+
{"value": "sd-core", "label": "Core"},
|
669
|
+
{"value": "stable-diffusion-xl-1024-v1-0", "label": "SDXL 1.0"},
|
670
|
+
{"value": "stable-diffusion-xl-1024-v0-9", "label": "SDXL 0.9"},
|
671
|
+
],
|
672
|
+
),
|
673
|
+
"cfg_scale": InputPort(
|
674
|
+
name="cfg_scale",
|
675
|
+
port_type=PortType.NUMBER,
|
676
|
+
value=7,
|
677
|
+
condition=f"return !{sd3_models}.includes(fieldsData.model.value)",
|
678
|
+
),
|
679
|
+
"sampler": InputPort(
|
680
|
+
name="sampler",
|
681
|
+
port_type=PortType.SELECT,
|
682
|
+
value="k_dpmpp_2m",
|
683
|
+
options=[
|
684
|
+
{"value": "ddim", "label": "ddim"},
|
685
|
+
{"value": "plms", "label": "plms"},
|
686
|
+
{"value": "k_euler", "label": "k_euler"},
|
687
|
+
{"value": "k_euler_ancestral", "label": "k_euler_ancestral"},
|
688
|
+
{"value": "k_heun", "label": "k_heun"},
|
689
|
+
{"value": "k_dpm_2", "label": "k_dpm_2"},
|
690
|
+
{"value": "k_dpm_2_ancestral", "label": "k_dpm_2_ancestral"},
|
691
|
+
{"value": "k_dpmpp_2s_ancestral", "label": "k_dpmpp_2s_ancestral"},
|
692
|
+
{"value": "k_dpmpp_2m", "label": "k_dpmpp_2m"},
|
693
|
+
{"value": "k_dpmpp_sde", "label": "k_dpmpp_sde"},
|
694
|
+
],
|
695
|
+
condition=f"return !{sd3_models}.includes(fieldsData.model.value)",
|
696
|
+
),
|
697
|
+
"size": InputPort(
|
698
|
+
name="size",
|
699
|
+
port_type=PortType.SELECT,
|
700
|
+
value="1024 x 1024",
|
701
|
+
options=[
|
702
|
+
{"value": "1024 x 1024", "label": "1024 x 1024"},
|
703
|
+
{"value": "1152 x 896", "label": "1152 x 896"},
|
704
|
+
{"value": "896 x 1152", "label": "896 x 1152"},
|
705
|
+
{"value": "1216 x 832", "label": "1216 x 832"},
|
706
|
+
{"value": "832 x 1216", "label": "832 x 1216"},
|
707
|
+
{"value": "1344 x 768", "label": "1344 x 768"},
|
708
|
+
{"value": "768 x 1344", "label": "768 x 1344"},
|
709
|
+
{"value": "1536 x 640", "label": "1536 x 640"},
|
710
|
+
{"value": "640 x 1536", "label": "640 x 1536"},
|
711
|
+
],
|
712
|
+
condition=f"return {special_width_height_models}.includes(fieldsData.model.value) && !{sd3_models}.includes(fieldsData.model.value)",
|
713
|
+
),
|
714
|
+
"aspect_ratio": InputPort(
|
715
|
+
name="aspect_ratio",
|
716
|
+
port_type=PortType.SELECT,
|
717
|
+
value="1:1",
|
718
|
+
options=[
|
719
|
+
{"value": "1:1", "label": "1:1"},
|
720
|
+
{"value": "16:9", "label": "16:9"},
|
721
|
+
{"value": "21:9", "label": "21:9"},
|
722
|
+
{"value": "2:3", "label": "2:3"},
|
723
|
+
{"value": "3:2", "label": "3:2"},
|
724
|
+
{"value": "4:5", "label": "4:5"},
|
725
|
+
{"value": "5:4", "label": "5:4"},
|
726
|
+
{"value": "9:16", "label": "9:16"},
|
727
|
+
{"value": "9:21", "label": "9:21"},
|
728
|
+
],
|
729
|
+
condition=f"return {sd3_models}.includes(fieldsData.model.value)",
|
730
|
+
),
|
731
|
+
"output_type": InputPort(
|
732
|
+
name="output_type",
|
733
|
+
port_type=PortType.SELECT,
|
734
|
+
value="markdown",
|
735
|
+
options=[
|
736
|
+
{"value": "only_link", "label": "only_link"},
|
737
|
+
{"value": "markdown", "label": "markdown"},
|
738
|
+
{"value": "html", "label": "html"},
|
739
|
+
],
|
740
|
+
),
|
741
|
+
"output": OutputPort(),
|
742
|
+
},
|
743
|
+
)
|