mypiper commited on
Commit
78cfd34
·
verified ·
1 Parent(s): a91de1e

Create artworks.yaml

Browse files
Files changed (1) hide show
  1. artworks.yaml +893 -0
artworks.yaml ADDED
@@ -0,0 +1,893 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _id: artworks
2
+ description: Image generation, mask extraction, etc.
3
+ readme: The first version is ready
4
+ title: en=ArtWorks AI;ru=Узлы ArtWorks AI
5
+ url: https://huggingface.co/PiperMy/Node-Packages/resolve/main/artworks.yaml
6
+ version: 2
7
+ nodes:
8
+ remove_background_artworks:
9
+ _id: remove_background_artworks
10
+ arrange:
11
+ x: 500
12
+ y: 110
13
+ category:
14
+ id: analyze_images
15
+ title: en=Image analysis;ru=Анализ изображений
16
+ environment:
17
+ OPEN_PAAS_USER:
18
+ title: PaaS user
19
+ type: string
20
+ scope: global
21
+ OPEN_PAAS_PASSWORD:
22
+ title: PaaS password
23
+ type: string
24
+ scope: global
25
+ PAAS_BASE_URL:
26
+ title: PaaS base url
27
+ type: string
28
+ scope: global
29
+ inputs:
30
+ image:
31
+ order: 1
32
+ title: en=Image;ru=Изображение
33
+ type: image
34
+ required: true
35
+ model:
36
+ order: 2
37
+ title: en=Model;ru=Модель
38
+ type: string
39
+ required: true
40
+ default: isnet-general-use
41
+ enum:
42
+ - isnet-general-use|IsNet
43
+ - u2net|U2Net
44
+ outputs:
45
+ image:
46
+ title: en=Image;ru=Изображение
47
+ type: image
48
+ package: artworks
49
+ script: |-
50
+ const PAAS_BASE_URL = env.variables.get('PAAS_BASE_URL');
51
+ if(!PAAS_BASE_URL) {
52
+ error.fatal('Please, set PAAS_BASE_URL in environment');
53
+ }
54
+ const OPEN_PAAS_USER = env.variables.get('OPEN_PAAS_USER');
55
+ if(!OPEN_PAAS_USER) {
56
+ error.fatal('Please, set OPEN_PAAS_USER in environment');
57
+ }
58
+ const OPEN_PAAS_PASSWORD = env.variables.get('OPEN_PAAS_PASSWORD');
59
+ if(!OPEN_PAAS_PASSWORD) {
60
+ error.fatal('Please, set OPEN_PAAS_PASSWORD in environment');
61
+ }
62
+ const PAAS_AUTH = {
63
+ username: OPEN_PAAS_USER,
64
+ password: OPEN_PAAS_PASSWORD
65
+ };
66
+ const CHECK_TASK_INTERVAL = 3000;
67
+
68
+ function getUrl(path) {
69
+ return `${PAAS_BASE_URL}/api/v3/${path}`;
70
+ }
71
+
72
+ async function createTask(payload) {
73
+ try {
74
+ const response = await httpClient({
75
+ method: "post",
76
+ url: getUrl("tasks"),
77
+ headers: {
78
+ "Content-type": "application/json",
79
+ },
80
+ auth: PAAS_AUTH,
81
+ data: JSON.stringify(payload),
82
+ });
83
+ const {
84
+ id
85
+ } = response.data;
86
+ return id;
87
+ } catch (e) {
88
+ const {
89
+ errors
90
+ } = e.response?.data || {};
91
+ if (errors?.length > 0) {
92
+ error.fatal(errors.join(", "));
93
+ }
94
+ error.fatal(e.statusText);
95
+ }
96
+ }
97
+
98
+ async function cancelTask(id) {
99
+ log(`Cancel task ${id}`);
100
+ try {
101
+ await httpClient({
102
+ method: "post",
103
+ url: getUrl(`tasks/${id}/cancel`),
104
+ headers: {
105
+ "Content-type": "application/json",
106
+ },
107
+ auth: PAAS_AUTH,
108
+ });
109
+ logger.debug(`Cancel task ${id}`);
110
+ } catch (e) {
111
+ const {
112
+ errors
113
+ } = e.response?.data;
114
+ if (errors?.length > 0) {
115
+ error.fatal(errors.join(", "));
116
+ }
117
+ error.fatal(e.statusText);
118
+ }
119
+ }
120
+
121
+ async function checkState(id) {
122
+ const {
123
+ data
124
+ } = await httpClient({
125
+ method: "get",
126
+ url: getUrl(`tasks/${id}`),
127
+ headers: {
128
+ "Content-type": "application/json",
129
+ },
130
+ auth: PAAS_AUTH,
131
+ });
132
+
133
+ const {
134
+ status,
135
+ results
136
+ } = data;
137
+ switch (status) {
138
+ case "preparing":
139
+ case "scheduling":
140
+ case "scheduled":
141
+ case "pending":
142
+ case "processing":
143
+ return null;
144
+ case "completed":
145
+ const {
146
+ data
147
+ } = results;
148
+ return data;
149
+ case "failed":
150
+ error.fatal(results.error);
151
+ default:
152
+ error.fatal("Wrong task status");
153
+ }
154
+ }
155
+
156
+ (async () => {
157
+
158
+ const {
159
+ image,
160
+ model,
161
+ } = inputs;
162
+
163
+ if (!state) {
164
+ const payload = {
165
+ type: "remove-image-background",
166
+ isFast: true,
167
+ payload: {
168
+ base64: false,
169
+ model,
170
+ image,
171
+ },
172
+ };
173
+ const task = await createTask(payload);
174
+ log(`Task created ${task}`);
175
+ return repeat({
176
+ state: {
177
+ payload,
178
+ task,
179
+ attempt: 0,
180
+ startedAt: new Date()
181
+ },
182
+ delay: 5000
183
+ });
184
+ } else {
185
+ const {
186
+ payload,
187
+ task,
188
+ attempt,
189
+ startedAt
190
+ } = state;
191
+ if (attempt > 200) {
192
+ await cancelTask(task);
193
+
194
+ const now = new Date();
195
+ const time = (now - new Date(startedAt)) / 1000;
196
+ error.timeout(`PaaS task for text to image ${task} timeout in ${time} sec`);
197
+ }
198
+
199
+ log(`Check task ${attempt} ${task}`);
200
+ const results = await checkState(task);
201
+ if (!results) {
202
+ return repeat({
203
+ delay: CHECK_TASK_INTERVAL,
204
+ state: {
205
+ payload,
206
+ task,
207
+ attempt: attempt + 1,
208
+ startedAt,
209
+ },
210
+ });
211
+ }
212
+ let { image: {url: image} } = results;
213
+ return next({
214
+ outputs: {
215
+ image
216
+ }
217
+ });
218
+ }
219
+
220
+ })();
221
+ source: catalog
222
+ title: en=Remove background;ru=Удалить фон
223
+ version: 1
224
+ generate_image_artworks:
225
+ _id: generate_image_artworks
226
+ arrange:
227
+ x: 170
228
+ y: 110
229
+ category:
230
+ id: generate_images
231
+ title: en=Generate images;ru=Генерация изображений
232
+ costs: |-
233
+ const COST_PER_IMAGE = 0.02;
234
+ (() => {
235
+ const { batchSize } = inputs;
236
+ return batchSize * COST_PER_IMAGE;
237
+ })()
238
+ environment:
239
+ OPEN_PAAS_USER:
240
+ title: PaaS user
241
+ type: string
242
+ scope: global
243
+ OPEN_PAAS_PASSWORD:
244
+ title: PaaS password
245
+ type: string
246
+ scope: global
247
+ PAAS_BASE_URL:
248
+ title: PaaS base url
249
+ type: string
250
+ scope: global
251
+ groups:
252
+ inputs:
253
+ SDXL:
254
+ order: 2
255
+ title: SDXL checkpoints
256
+ description: Only for SDXL checkpoints
257
+ base:
258
+ order: 1
259
+ title: en=Base parameters;ru=Базовые параметры
260
+ inputs:
261
+ checkpoint:
262
+ order: 2
263
+ title: Checkpoint
264
+ group: base
265
+ type: string
266
+ required: true
267
+ default: juggernautXL_v9Rundiffusionphoto2.safetensors
268
+ enum:
269
+ - raemuXL_v40.safetensors|Raemu XL <SDXL>
270
+ - aamXLAnimeMix_v10.safetensors|AAM XL (Anime Mix) <SDXL> <Fantasy>
271
+ - dreamweaverPony25D.1erv.safetensors|DreamWeaver - Pony 2.5D Mix <SDXL>
272
+ - mixGEMAdam8witQegoow.NeWz.safetensors|MyMIX-G/Jem <SDXL> <Realistic>
273
+ - mfcgPDXL_v10.safetensors|MFCG PDXL <SDXL>
274
+ - aniku_0.2.fp16.safetensors|Anime Desire <SDXL> <Fantasy>
275
+ - flux1DevHyperNF4Flux1DevBNB_flux1DevHyperNF4.safetensors|Hyper NF4 Flux 1 <Flux>
276
+ - STOIQONewrealityFLUXSD_F1DPreAlpha.safetensors|New Reality Flux <Flux>
277
+ - juggernautXL_v9Rundiffusionphoto2.safetensors|Juggernaut XL <SDXL>
278
+ - animaPencilXL_v260.safetensors|Anima Pencil XL <SDXL> <Fantasy>
279
+ - bluePencilXL_v401.safetensors|Blue Pencil XL <SDXL> <Fantasy>
280
+ - pixelArtDiffusionXL_spriteShaper.safetensors|Pixel Art Diffusion XL <SDXL> <Fantasy>
281
+ - albedobaseXL_v20.safetensors|AlbedoBase XL <SDXL>
282
+ - leosamsHelloworldXL_helloworldXL50GPT4V.safetensors|Helloworld XL <SDXL>
283
+ - dynavisionXLAllInOneStylized_releaseV0610Bakedvae.safetensors|DynaVision XL All In One <SDXL>
284
+ - photon_v1.safetensors|Photon <SD 1.5>
285
+ - afroditexlNudePeople_20Bkdvae.safetensors|Nude People <NSFW>
286
+ - nosft-float8-e4m3fn.safetensors|Flux Nude People <NSFW>
287
+ - asdf_0.4a_lorapov_0.2_lust_0.4.fp16.safetensors|Real Porn <NSFW>
288
+ - Sexy_Aesthetic_SDXL_0.4x0.2.fp16.safetensors|Sexy & Beauty <NSFW>
289
+ - aniku_0.2.fp16.safetensors|Anime Desire <NSFW>
290
+ - anikurender_0.4b.fp16.safetensors|Hardcore Fantasy <NSFW>
291
+ prompt:
292
+ order: 1
293
+ title: Prompt
294
+ group: base
295
+ type: string
296
+ required: true
297
+ multiline: true
298
+ default: cat walking on the moon
299
+ imageSize:
300
+ order: 4
301
+ title: Size
302
+ group: base
303
+ type: string
304
+ required: true
305
+ default: 1024x1024
306
+ enum:
307
+ - 512x512|512x512 <SD 1.5>
308
+ - 512x768|512x768 <SD 1.5>
309
+ - 512x912|512x912 <SD 1.5>
310
+ - 576x768|576x768 <SD 1.5>
311
+ - 704x1344|704x1344 <SD 1.5>
312
+ - 704x1408|704x1408 <SD 1.5>
313
+ - 768x512|768x512 <SD 1.5>
314
+ - 768x576|768x576 <SD 1.5>
315
+ - 768x768|768x768 <SD 1.5>
316
+ - 768x1280|768x1280 <SD 1.5>
317
+ - 768x1344|768x1344 <SD 1.5>
318
+ - 832x1152|832x1152 <SD 1.5>
319
+ - 832x1216|832x1216 <SD 1.5>
320
+ - 896x1088|896x1088 <SD 1.5>
321
+ - 896x1152|896x1152 <SD 1.5>
322
+ - 912x512|912x512 <SD 1.5>
323
+ - 960x1024|960x1024 <SDXL> <Flux> <SD 1.5>
324
+ - 960x1088|960x1088 <SDXL> <Flux> <SD 1.5>
325
+ - 1024x1024|1024x1024 <SDXL> <Flux> <SD 1.5>
326
+ - 1024x960|1024x960 <SDXL> <Flux> <SD 1.5>
327
+ - 1088x896|1088x896 <SDXL> <Flux> <SD 1.5>
328
+ - 1088x960|1088x960 <SDXL> <Flux> <SD 1.5>
329
+ - 1152x832|1152x832 <SDXL> <Flux> <SD 1.5>
330
+ - 1152x896|1152x896 <SDXL> <Flux> <SD 1.5>
331
+ - 1216x832|1216x832 <SDXL> <Flux>
332
+ - 1280x768|1280x768 <SDXL> <Flux>
333
+ - 1344x704|1344x704 <SDXL> <Flux>
334
+ - 1344x768|1344x768 <SDXL> <Flux>
335
+ - 1408x704|1408x704 <SDXL> <Flux>
336
+ - 1472x704|1472x704 <SDXL> <Flux>
337
+ - 1536x640|1536x640 <SDXL> <Flux>
338
+ - 1600x640|1600x640 <SDXL> <Flux>
339
+ - 1664x576|1664x576 <SDXL> <Flux>
340
+ - 1728x576|1728x576 <SDXL> <Flux>
341
+ batchSize:
342
+ order: 7
343
+ title: Batch size
344
+ group: base
345
+ type: integer
346
+ min: 1
347
+ max: 4
348
+ step: 1
349
+ default: 1
350
+ negativePrompt:
351
+ order: 3
352
+ title: Negative prompt
353
+ group: base
354
+ type: string
355
+ multiline: true
356
+ cfgScale:
357
+ order: 5
358
+ title: CFG scale
359
+ group: base
360
+ type: float
361
+ required: true
362
+ min: 1
363
+ max: 20
364
+ step: 1
365
+ default: 7
366
+ performance:
367
+ order: 6
368
+ title: Performance
369
+ group: base
370
+ type: string
371
+ default: speed
372
+ enum:
373
+ - express|⚡ Express
374
+ - speed|🚅 Speed
375
+ - quality|💎 Quality
376
+ styles:
377
+ order: 2
378
+ title: Styles
379
+ group: SDXL
380
+ type: string[]
381
+ enum:
382
+ - Abstract Expressionism
383
+ - Academia
384
+ - Action Figure
385
+ - Adorable 3D Character
386
+ - Adorable Kawaii
387
+ - Ads Advertising
388
+ - Ads Automotive
389
+ - Ads Corporate
390
+ - Ads Fashion Editorial
391
+ - Ads Food Photography
392
+ - Ads Gourmet Food Photography
393
+ - Ads Luxury
394
+ - Ads Real Estate
395
+ - Ads Retail
396
+ - Art Deco
397
+ - Art Nouveau
398
+ - Artstyle Abstract
399
+ - Artstyle Abstract Expressionism
400
+ - Artstyle Art Deco
401
+ - Artstyle Art Nouveau
402
+ - Artstyle Constructivist
403
+ - Artstyle Cubist
404
+ - Artstyle Expressionist
405
+ - Artstyle Graffiti
406
+ - Artstyle Hyperrealism
407
+ - Artstyle Impressionist
408
+ - Artstyle Pointillism
409
+ - Artstyle Pop Art
410
+ - Artstyle Psychedelic
411
+ - Artstyle Renaissance
412
+ - Artstyle Steampunk
413
+ - Artstyle Surrealist
414
+ - Artstyle Typography
415
+ - Artstyle Watercolor
416
+ - Astral Aura
417
+ - Avant Garde
418
+ - Baroque
419
+ - Bauhaus Style Poster
420
+ - Blueprint Schematic Drawing
421
+ - Caricature
422
+ - Cel Shaded Art
423
+ - Character Design Sheet
424
+ - Cinematic Diva
425
+ - Classicism Art
426
+ - Color Field Painting
427
+ - Colored Pencil Art
428
+ - Conceptual Art
429
+ - Constructivism
430
+ - Cubism
431
+ - Dadaism
432
+ - Dark Fantasy
433
+ - Dark Moody Atmosphere
434
+ - Dmt Art Style
435
+ - Doodle Art
436
+ - Double Exposure
437
+ - Dripping Paint Splatter Art
438
+ - Expressionism
439
+ - Faded Polaroid Photo
440
+ - Fauvism
441
+ - Flat 2d Art
442
+ - Fooocus Cinematic
443
+ - Fooocus Enhance
444
+ - Fooocus Masterpiece
445
+ - Fooocus Negative
446
+ - Fooocus Photograph
447
+ - Fooocus Semi Realistic
448
+ - Fooocus Sharp
449
+ - Fooocus V2
450
+ - Fortnite Art Style
451
+ - Futurism
452
+ - Futuristic Biomechanical
453
+ - Futuristic Biomechanical Cyberpunk
454
+ - Futuristic Cybernetic
455
+ - Futuristic Cybernetic Robot
456
+ - Futuristic Cyberpunk Cityscape
457
+ - Futuristic Futuristic
458
+ - Futuristic Retro Cyberpunk
459
+ - Futuristic Retro Futurism
460
+ - Futuristic Sci Fi
461
+ - Futuristic Vaporwave
462
+ - Game Bubble Bobble
463
+ - Game Cyberpunk Game
464
+ - Game Fighting Game
465
+ - Game Gta
466
+ - Game Mario
467
+ - Game Minecraft
468
+ - Game Pokemon
469
+ - Game Retro Arcade
470
+ - Game Retro Game
471
+ - Game Rpg Fantasy Game
472
+ - Game Strategy Game
473
+ - Game Streetfighter
474
+ - Game Zelda
475
+ - Glitchcore
476
+ - Glo Fi
477
+ - Googie Art Style
478
+ - Graffiti Art
479
+ - Harlem Renaissance Art
480
+ - High Fashion
481
+ - Idyllic
482
+ - Impressionism
483
+ - Infographic Drawing
484
+ - Ink Dripping Drawing
485
+ - Japanese Ink Drawing
486
+ - Knolling Photography
487
+ - Light Cheery Atmosphere
488
+ - Logo Design
489
+ - Luxurious Elegance
490
+ - MRE Ancient Illustration
491
+ - MRE Anime
492
+ - MRE Artistic Vision
493
+ - MRE Bad Dream
494
+ - MRE Brave Art
495
+ - MRE Cinematic Dynamic
496
+ - MRE Comic
497
+ - MRE Dark Cyberpunk
498
+ - MRE Dark Dream
499
+ - MRE Dynamic Illustration
500
+ - MRE Elemental Art
501
+ - MRE Gloomy Art
502
+ - MRE Heroic Fantasy
503
+ - MRE Lyrical Geometry
504
+ - MRE Manga
505
+ - MRE Space Art
506
+ - MRE Spontaneous Picture
507
+ - MRE Sumi E Detailed
508
+ - MRE Sumi E Symbolic
509
+ - MRE Surreal Painting
510
+ - MRE Undead Art
511
+ - MRE Underground
512
+ - Macro Photography
513
+ - Mandola Art
514
+ - Marker Drawing
515
+ - Medievalism
516
+ - Minimalism
517
+ - Misc Architectural
518
+ - Misc Disco
519
+ - Misc Dreamscape
520
+ - Misc Dystopian
521
+ - Misc Fairy Tale
522
+ - Misc Gothic
523
+ - Misc Grunge
524
+ - Misc Horror
525
+ - Misc Kawaii
526
+ - Misc Lovecraftian
527
+ - Misc Macabre
528
+ - Misc Manga
529
+ - Misc Metropolis
530
+ - Misc Minimalist
531
+ - Misc Monochrome
532
+ - Misc Nautical
533
+ - Misc Space
534
+ - Misc Stained Glass
535
+ - Misc Techwear Fashion
536
+ - Misc Tribal
537
+ - Misc Zentangle
538
+ - Mk Adnate Style
539
+ - Mk Afrofuturism
540
+ - Mk Albumen Print
541
+ - Mk Alcohol Ink Art
542
+ - Mk Andy Warhol
543
+ - Mk Anthotype Print
544
+ - Mk Aquatint Print
545
+ - Mk Atompunk
546
+ - Mk Basquiat
547
+ - Mk Bauhaus Style
548
+ - Mk Blacklight Paint
549
+ - Mk Bromoil Print
550
+ - Mk Calotype Print
551
+ - Mk Carnival Glass
552
+ - Mk Chicano Art
553
+ - Mk Chromolithography
554
+ - Mk Cibulak Porcelain
555
+ - Mk Color Sketchnote
556
+ - Mk Coloring Book
557
+ - Mk Constructivism
558
+ - Mk Cross Processing Print
559
+ - Mk Cross Stitching
560
+ - Mk Cyanotype Print
561
+ - Mk Dayak Art
562
+ - Mk De Stijl
563
+ - Mk Dufaycolor Photograph
564
+ - Mk Embroidery
565
+ - Mk Encaustic Paint
566
+ - Mk Fayum Portrait
567
+ - Mk Gond Painting
568
+ - Mk Gyotaku
569
+ - Mk Halftone Print
570
+ - Mk Herbarium
571
+ - Mk Illuminated Manuscript
572
+ - Mk Inuit Carving
573
+ - Mk Kalighat Painting
574
+ - Mk Lite Brite Art
575
+ - Mk Luminogram
576
+ - Mk Madhubani Painting
577
+ - Mk Mokume Gane
578
+ - Mk Mosaic
579
+ - Mk One Line Art
580
+ - Mk Palekh
581
+ - Mk Patachitra Painting
582
+ - Mk Pichwai Painting
583
+ - Mk Pictorialism
584
+ - Mk Pollock
585
+ - Mk Punk Collage
586
+ - Mk Ron English Style
587
+ - Mk Samoan Art Inspired
588
+ - Mk Scrimshaw
589
+ - Mk Shepard Fairey Style
590
+ - Mk Shibori
591
+ - Mk Singer Sargent
592
+ - Mk Suminagashi
593
+ - Mk Tlingit Art
594
+ - Mk Ukiyo E
595
+ - Mk Van Gogh
596
+ - Mk Vintage Airline Poster
597
+ - Mk Vintage Travel Poster
598
+ - Mk Vitreous Enamel
599
+ - Neo Baroque
600
+ - Neo Byzantine
601
+ - Neo Futurism
602
+ - Neo Impressionism
603
+ - Neo Rococo
604
+ - Neoclassicism
605
+ - Op Art
606
+ - Ornate And Intricate
607
+ - Papercraft Collage
608
+ - Papercraft Flat Papercut
609
+ - Papercraft Kirigami
610
+ - Papercraft Paper Mache
611
+ - Papercraft Paper Quilling
612
+ - Papercraft Papercut Collage
613
+ - Papercraft Papercut Shadow Box
614
+ - Papercraft Stacked Papercut
615
+ - Papercraft Thick Layered Papercut
616
+ - Pebble Art
617
+ - Pencil Sketch Drawing
618
+ - Photo Alien
619
+ - Photo Film Noir
620
+ - Photo Glamour
621
+ - Photo Hdr
622
+ - Photo Iphone Photographic
623
+ - Photo Long Exposure
624
+ - Photo Neon Noir
625
+ - Photo Silhouette
626
+ - Photo Tilt Shift
627
+ - Pop Art 2
628
+ - Random Style
629
+ - Rococo
630
+ - SAI 3D Model
631
+ - SAI Analog Film
632
+ - SAI Anime
633
+ - SAI Cinematic
634
+ - SAI Comic Book
635
+ - SAI Craft Clay
636
+ - SAI Digital Art
637
+ - SAI Enhance
638
+ - SAI Fantasy Art
639
+ - SAI Isometric
640
+ - SAI Line Art
641
+ - SAI Lowpoly
642
+ - SAI Neonpunk
643
+ - SAI Origami
644
+ - SAI Photographic
645
+ - SAI Pixel Art
646
+ - SAI Texture
647
+ - Silhouette Art
648
+ - Simple Vector Art
649
+ - Sketchup
650
+ - Steampunk 2
651
+ - Sticker Designs
652
+ - Suprematism
653
+ - Surrealism
654
+ - Terragen
655
+ - Tranquil Relaxing Atmosphere
656
+ - Vibrant Rim Light
657
+ - Volumetric Lighting
658
+ - Watercolor 2
659
+ - Whimsical And Playful
660
+ sharpness:
661
+ order: 1
662
+ title: Sharpness
663
+ group: SDXL
664
+ type: integer
665
+ min: 0
666
+ max: 30
667
+ step: 1
668
+ default: 2
669
+ seed:
670
+ order: 8
671
+ title: Seed
672
+ group: base
673
+ type: integer
674
+ placeholder: no seed
675
+ outputs:
676
+ image:
677
+ title: Image
678
+ type: image
679
+ images:
680
+ title: Images
681
+ type: image[]
682
+ package: artworks
683
+ script: |-
684
+ const PAAS_BASE_URL = env.variables.get('PAAS_BASE_URL');
685
+ if(!PAAS_BASE_URL) {
686
+ error.fatal('Please, set PAAS_BASE_URL in environment');
687
+ }
688
+ const OPEN_PAAS_USER = env.variables.get('OPEN_PAAS_USER');
689
+ if(!OPEN_PAAS_USER) {
690
+ error.fatal('Please, set OPEN_PAAS_USER in environment');
691
+ }
692
+ const OPEN_PAAS_PASSWORD = env.variables.get('OPEN_PAAS_PASSWORD');
693
+ if(!OPEN_PAAS_PASSWORD) {
694
+ error.fatal('Please, set OPEN_PAAS_PASSWORD in environment');
695
+ }
696
+ const PAAS_AUTH = {
697
+ username: OPEN_PAAS_USER,
698
+ password: OPEN_PAAS_PASSWORD
699
+ };
700
+ const CHECK_TASK_INTERVAL = 3000;
701
+
702
+ function getUrl(path) {
703
+ return `${PAAS_BASE_URL}/api/v3/${path}`;
704
+ }
705
+
706
+ async function createTask(payload) {
707
+
708
+ try {
709
+ const response = await httpClient({
710
+ method: "post",
711
+ url: getUrl("tasks"),
712
+ headers: {
713
+ "Content-type": "application/json",
714
+ },
715
+ auth: PAAS_AUTH,
716
+ data: JSON.stringify(payload),
717
+ });
718
+ const {
719
+ id
720
+ } = response.data;
721
+ return id;
722
+ } catch (e) {
723
+ const {
724
+ errors
725
+ } = e.response?.data;
726
+ if (errors?.length > 0) {
727
+ error.data(errors.join(", "));
728
+ }
729
+ error.fatal(e.statusText);
730
+ }
731
+ }
732
+
733
+ async function cancelTask(id) {
734
+ log(`Cancel task ${id}`);
735
+ try {
736
+ await httpClient({
737
+ method: "post",
738
+ url: getUrl(`tasks/${id}/cancel`),
739
+ headers: {
740
+ "Content-type": "application/json",
741
+ },
742
+ auth: PAAS_AUTH,
743
+ });
744
+ } catch (e) {
745
+ const {
746
+ errors
747
+ } = e.response?.data;
748
+ if (errors?.length > 0) {
749
+ logger.error(errors.join(", "));
750
+ error.data(errors.join(", "));
751
+ }
752
+ error.fatal(e.statusText);
753
+ }
754
+ }
755
+
756
+ async function checkState(id) {
757
+ const {
758
+ data
759
+ } = await httpClient({
760
+ method: "get",
761
+ url: getUrl(`tasks/${id}`),
762
+ headers: {
763
+ "Content-type": "application/json",
764
+ },
765
+ auth: PAAS_AUTH,
766
+ });
767
+
768
+ const {
769
+ status,
770
+ results
771
+ } = data;
772
+ switch (status) {
773
+ case "preparing":
774
+ case "scheduling":
775
+ case "scheduled":
776
+ case "pending":
777
+ case "processing":
778
+ return null;
779
+ case "completed":
780
+ const {
781
+ data
782
+ } = results;
783
+ return data;
784
+ case "failed":
785
+ const {
786
+ error
787
+ } = results;
788
+ error.fatal(error);
789
+ default:
790
+ error.fatal("Wrong task status");
791
+ }
792
+ }
793
+
794
+ (async () => {
795
+
796
+ const {
797
+ prompt,
798
+ negativePrompt,
799
+ checkpoint,
800
+ cfgScale,
801
+ imageSize: size,
802
+ performance,
803
+ sharpness,
804
+ seed,
805
+ batchSize,
806
+ // SDXL
807
+ styles,
808
+ } = inputs;
809
+
810
+ if (!state) {
811
+ const payload = {
812
+ type: "text-to-image",
813
+ isFast: true,
814
+ payload: {
815
+ base64: false,
816
+ prompt,
817
+ ...(!!negativePrompt ? {
818
+ negativePrompt
819
+ } : {}),
820
+ checkpoint,
821
+ cfgScale,
822
+ size,
823
+ ...(performance !== "speed" ? {
824
+ performance
825
+ } : {}),
826
+ ...(seed > 0 ? {
827
+ seed
828
+ } : {}),
829
+ ...(batchSize > 1 ? {
830
+ batchSize
831
+ } : {}),
832
+ // SDXL
833
+ ...(styles?.length > 0 ? {
834
+ styles
835
+ } : {}),
836
+ ...(sharpness > 2 ? {
837
+ sharpness
838
+ } : {}),
839
+ },
840
+ };
841
+ const task = await createTask(payload);
842
+ log(`Task created ${task}`);
843
+ return repeat({
844
+ state: {
845
+ payload,
846
+ task,
847
+ attempt: 0,
848
+ startedAt: new Date()
849
+ },
850
+ delay: 5000
851
+ });
852
+ } else {
853
+ const {
854
+ payload,
855
+ task,
856
+ attempt,
857
+ startedAt
858
+ } = state;
859
+ if (attempt > 200) {
860
+ await cancelTask(task);
861
+
862
+ const now = new Date();
863
+ const time = (now - new Date(startedAt)) / 1000;
864
+ error.timeout(`PaaS task for text to image ${task} timeout in ${time} sec`);
865
+ }
866
+
867
+ log(`Check task ${attempt} ${task}`);
868
+ const results = await checkState(task);
869
+ if (!results) {
870
+ return repeat({
871
+ delay: CHECK_TASK_INTERVAL,
872
+ state: {
873
+ payload,
874
+ task,
875
+ attempt: attempt + 1,
876
+ startedAt,
877
+ },
878
+ });
879
+ }
880
+ let images = results.images.map((i) => i.url);
881
+ const [image] = images;
882
+ return next({
883
+ outputs: {
884
+ images,
885
+ image: image
886
+ }
887
+ });
888
+ }
889
+
890
+ })();
891
+ source: catalog
892
+ title: en=Generate image;ru=Генерация изображения
893
+ version: 1