mypiper commited on
Commit
d25a947
·
verified ·
1 Parent(s): a2e2b1b

Update artworks.yaml

Browse files
Files changed (1) hide show
  1. artworks.yaml +2099 -472
artworks.yaml CHANGED
@@ -3,21 +3,32 @@ 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
- inpaint_image_artworks:
9
- _id: inpaint_image_artworks
10
  arrange:
11
- x: 440
12
- y: 60
13
  category:
 
14
  id: generate_images
15
  title: en=Generate images;ru=Генерация изображений
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  groups:
17
  inputs:
18
- mask:
19
- order: 2
20
- title: en=Mask;ru=Маска
21
  SDXL:
22
  order: 4
23
  title: SDXL checkpoints
@@ -25,9 +36,6 @@ nodes:
25
  base:
26
  order: 1
27
  title: en=Base;ru=Базовые параметры
28
- special:
29
- order: 3
30
- title: en=Special;ru=Специальные возможности
31
  inputs:
32
  image:
33
  order: 1
@@ -35,10 +43,6 @@ nodes:
35
  group: base
36
  type: image
37
  required: true
38
- extensions:
39
- - id: draw-mask
40
- params:
41
- mask: mask
42
  prompt:
43
  order: 2
44
  title: en=Prompt;ru=Подсказка
@@ -123,18 +127,12 @@ nodes:
123
  - express|⚡ Express
124
  - speed|🚅 Speed
125
  - quality|💎 Quality
126
- controlNets:
127
- order: 1
128
- title: en=Control nets;ru=Контрольные сети
129
- group: special
130
- type: json
131
- schema:
132
- id: control-nets
133
  seed:
134
  order: 10
135
  title: en=Seed;ru=Начальный шум
136
  group: base
137
  type: integer
 
138
  batchSize:
139
  order: 9
140
  title: en=Batch size;ru=Кол-во
@@ -144,24 +142,15 @@ nodes:
144
  max: 4
145
  step: 1
146
  default: 1
147
- mask:
148
- order: 1
149
- title: en=Mask;ru=Маска
150
- group: mask
151
- type: image
152
- required: true
153
- invertMask:
154
  order: 1
155
- title: en=Invert mask;ru=Инвертировать маску
156
  group: SDXL
157
- type: boolean
158
- default: false
159
- maskMargin:
160
- order: 2
161
- title: en=Mask margin;ru=Отступ от маски
162
- group: mask
163
  type: integer
164
- default: 10
 
 
 
165
  outputs:
166
  image1:
167
  title: en=Image 1;ru=Изображение 1
@@ -220,16 +209,11 @@ nodes:
220
  performance,
221
  batchSize,
222
  seed,
223
- // mask
224
- mask,
225
- maskMargin,
226
- // special
227
- controlNets,
228
  // SDXL
229
- invertMask,
230
  } = inputs;
231
  const payload = {
232
- type: "inpaint-on-image",
233
  isFast: true,
234
  payload: {
235
  base64: false,
@@ -255,13 +239,8 @@ nodes:
255
  performance,
256
  ...(batchSize > 1 ? { batchSize } : {}),
257
  seed,
258
- // mask
259
- mask,
260
- maskMargin,
261
- // special
262
- controlNets,
263
  // SDXL
264
- invertMask
265
  },
266
  };
267
  try {
@@ -343,29 +322,17 @@ nodes:
343
  }
344
  }
345
  source: catalog
346
- title: en=Inpaint on image;ru=Улучшить изображение
347
  version: 1
348
- environment:
349
- OPEN_PAAS_USER:
350
- title: PaaS user
351
- type: string
352
- scope: global
353
- OPEN_PAAS_PASSWORD:
354
- title: PaaS password
355
- type: string
356
- scope: global
357
- PAAS_BASE_URL:
358
- title: PaaS base url
359
- type: string
360
- scope: global
361
- face_swap_on_image:
362
- _id: face_swap_on_image
363
  arrange:
364
- x: 760
365
- y: 180
366
  category:
367
- id: deep_swap
368
- title: en=Deep swap;ru=Глубокая замена
 
369
  environment:
370
  OPEN_PAAS_USER:
371
  title: PaaS user
@@ -379,25 +346,166 @@ nodes:
379
  title: PaaS base url
380
  type: string
381
  scope: global
 
 
 
 
 
 
 
 
 
382
  inputs:
383
- face:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
384
  order: 1
385
- title: en=Face;ru=Лицо
386
- type: image
 
387
  required: true
388
- image:
389
- order: 2
390
- title: en=Image;ru=Изображение
391
- type: image
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
392
  required: true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
393
  outputs:
394
- image:
395
- title: en=Image;ru=Изображение
 
 
 
 
 
 
 
 
 
 
 
 
396
  type: image
397
  package: artworks
398
  script: |
399
  const CHECK_TASK_INTERVAL = 3000;
400
- const MAX_ATTEMPTS = 20;
401
 
402
  export async function run({ inputs, state }) {
403
 
@@ -425,18 +533,48 @@ nodes:
425
 
426
  if (!state) {
427
  const {
428
- face,
429
- image
 
 
 
 
 
 
 
 
 
430
  } = inputs;
431
 
432
  const payload = {
433
- type: "faceswap-on-image",
434
  isFast: true,
435
  payload: {
436
  base64: false,
437
- face,
438
- image,
439
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
440
  };
441
  try {
442
  const task = await artworks.createTask(payload);
@@ -497,10 +635,15 @@ nodes:
497
  },
498
  });
499
  }
500
- let { images: [{ url: image }] } = results;
 
501
  return NextNode.from({
502
  outputs: {
503
- image
 
 
 
 
504
  }
505
  });
506
  } catch (e) {
@@ -512,78 +655,1556 @@ nodes:
512
  }
513
  }
514
  source: catalog
515
- title: en=Face swap on image;ru=Замена лица на изображении
516
  version: 1
517
- translate_text:
518
- _id: translate_text
519
  arrange:
520
  x: 770
521
- y: 370
522
  category:
523
- id: process_text
524
- title: en=Process text;ru=Обработка текста
525
- inputs:
526
- source:
527
- order: 1
528
- title: Source language
529
  type: string
530
- required: true
531
- default: auto
532
- enum:
533
- - auto|Auto
534
- - en|English
535
- - de|German
536
- - ru|Russian
537
- - es|Spanish
538
- - fr|French
539
- - it|Italian
540
- - pt|Portuguese
541
- - ja|Japanese
542
- - ko|Korean
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
543
  - hi|Hindi
544
  - tr|Turkish
545
  - zh|Chinese Simplified
546
  target:
547
  order: 2
548
- title: Target
549
  description: github://generative-core/piper/main/docs/nodes/translate-text/target.md
550
  type: string
551
- required: true
552
- default: de
553
- enum:
554
- - en|English
555
- - de|German
556
- - ru|Russian
557
- - es|Spanish
558
- - fr|French
559
- - it|Italian
560
- - pt|Portuguese
561
- - ja|Japanese
562
- - ko|Korean
563
- - hi|Hindi
564
- - tr|Turkish
565
- - zh|Chinese Simplified
566
- text:
567
- order: 3
568
- title: Text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
569
  type: string
 
 
 
 
 
 
 
 
 
 
 
570
  required: true
571
- multiline: true
572
  outputs:
573
- text:
574
- title: Text
575
- type: string
576
- alternatives:
577
- title: Alternatives
578
- type: string[]
579
- detectedLanguage:
580
- title: Detected language
581
- type: json
582
- schema: detected-languages
583
  package: artworks
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
584
  source: catalog
585
- title: en=Translate text;ru=Перевести текст
586
  version: 1
 
 
 
 
 
 
 
 
 
587
  environment:
588
  OPEN_PAAS_USER:
589
  title: PaaS user
@@ -596,10 +2217,30 @@ nodes:
596
  PAAS_BASE_URL:
597
  title: PaaS base url
598
  type: string
599
- scope: global
600
- script: |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
601
  const CHECK_TASK_INTERVAL = 3000;
602
- const MAX_ATTEMPTS = 10;
603
 
604
  export async function run({ inputs, state }) {
605
 
@@ -626,15 +2267,18 @@ nodes:
626
  });
627
 
628
  if (!state) {
629
- const { source, target, text } = inputs;
 
 
 
630
 
631
  const payload = {
632
- type: "translate-text",
633
  isFast: true,
634
  payload: {
635
- source,
636
- target,
637
- text,
638
  },
639
  };
640
  try {
@@ -651,7 +2295,7 @@ nodes:
651
  total: MAX_ATTEMPTS,
652
  processed: 0
653
  },
654
- delay: 2000
655
  });
656
  } catch (e) {
657
  if (e instanceof ArtWorksError) {
@@ -666,7 +2310,7 @@ nodes:
666
  attempt,
667
  startedAt
668
  } = state;
669
-
670
  if (attempt > MAX_ATTEMPTS) {
671
  try {
672
  await artworks.cancelTask(task);
@@ -696,13 +2340,10 @@ nodes:
696
  },
697
  });
698
  }
699
- console.log(results);
700
- const { alternatives, detectedLanguage, text } = results;
701
  return NextNode.from({
702
  outputs: {
703
- alternatives,
704
- detectedLanguage,
705
- text
706
  }
707
  });
708
  } catch (e) {
@@ -713,12 +2354,16 @@ nodes:
713
  }
714
  }
715
  }
716
- upscale_image:
717
- _id: upscale_image
 
 
 
718
  arrange:
719
- x: 100
720
- y: 410
721
  category:
 
722
  id: generate_images
723
  title: en=Generate images;ru=Генерация изображений
724
  environment:
@@ -734,37 +2379,171 @@ nodes:
734
  title: PaaS base url
735
  type: string
736
  scope: global
 
 
 
 
 
 
 
 
737
  inputs:
738
  image:
739
  order: 1
740
- title: Image
 
741
  type: image
742
  required: true
743
- upscalingResize:
744
  order: 2
745
- title: Resize
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
746
  type: float
747
  required: true
748
  min: 0.1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
749
  max: 4
750
- step: 0.1
751
- default: 2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
752
  outputs:
753
- image:
754
- title: Image
 
 
 
 
 
 
 
 
 
 
 
 
755
  type: image
756
  package: artworks
757
- source: catalog
758
- title: en=Upscale image;ru=Увеличить изображение
759
- version: 1
760
- script: |-
761
- const CHECK_TASK_INTERVAL = 3000;
762
- const MAX_ATTEMPTS = 20;
763
 
764
  export async function run({ inputs, state }) {
765
 
766
  const { FatalError, TimeoutError, RepeatNode, NextNode } = DEFINITIONS;
767
- const { ArtWorks, FatalError: ArtWorksError } = require('artworks');
 
768
 
769
  const PAAS_BASE_URL = env.variables.get('PAAS_BASE_URL');
770
  if (!PAAS_BASE_URL) {
@@ -788,16 +2567,39 @@ nodes:
788
  if (!state) {
789
  const {
790
  image,
791
- upscalingResize,
 
 
 
 
 
 
 
 
 
 
 
 
792
  } = inputs;
793
-
794
  const payload = {
795
- type: "upscale-image",
796
  isFast: true,
797
  payload: {
798
  base64: false,
799
  image,
800
- upscalingResize,
 
 
 
 
 
 
 
 
 
 
 
 
801
  },
802
  };
803
  try {
@@ -859,10 +2661,15 @@ nodes:
859
  },
860
  });
861
  }
862
- let { image: { url: image } } = results;
 
863
  return NextNode.from({
864
  outputs: {
865
- image
 
 
 
 
866
  }
867
  });
868
  } catch (e) {
@@ -873,14 +2680,18 @@ nodes:
873
  }
874
  }
875
  }
876
- exctract_mask_on_image:
877
- _id: exctract_mask_on_image
 
 
 
878
  arrange:
879
- x: 900
880
- y: 50
881
  category:
882
- id: image_analysis
883
- title: en=Image analysis;ru=Анализ изображений
 
884
  environment:
885
  OPEN_PAAS_USER:
886
  title: PaaS user
@@ -895,76 +2706,37 @@ nodes:
895
  type: string
896
  scope: global
897
  inputs:
898
- image:
899
  order: 1
900
- title: Image
901
- type: image
902
- required: true
903
- type:
904
- order: 2
905
- title: Type
906
  type: string
907
  required: true
908
- default: yolo
909
  enum:
910
- - yolo|Yolo
911
- - default|Prompt
912
- prompt:
913
- order: 4
914
- title: Prompt
915
- type: string
916
- required: false
917
- multiline: true
918
- model:
919
  order: 3
920
- title: Yolo model
 
921
  type: string
922
- required: false
923
- default: deepfashion2_yolov8s-seg.pt
924
- enum:
925
- - deepfashion2_yolov8s-seg.pt
926
- - face_yolov8m.pt
927
- - face_yolov8n.pt
928
- - face_yolov8s.pt
929
- - female_breast_v3.2.pt
930
- - hand_yolov8n.pt
931
- - hand_yolov8s.pt
932
- - penisV2.pt
933
- - person_yolov8m-seg.pt
934
- - person_yolov8n-seg.pt
935
- - person_yolov8s-seg.pt
936
- - vagina-v2.6.pt
937
- threshold:
938
- order: 5
939
- title: Threshold
940
- type: float
941
- required: true
942
- min: 0.1
943
- max: 0.69
944
- step: 0.1
945
- default: 0.5
946
- confidence:
947
- order: 6
948
- title: Confidence
949
- type: float
950
  required: true
951
- min: 0.1
952
- max: 0.99
953
- step: 0.1
954
- default: 0.5
955
- applyConvexHull:
956
- order: 8
957
- title: Apply convex hull
958
- type: boolean
959
- default: false
 
960
  outputs:
961
- merged:
962
- title: Merged
963
- type: image
964
- masks:
965
- title: Masks
966
  type: json
967
- schema: image-masks
968
  package: artworks
969
  script: |-
970
  const CHECK_TASK_INTERVAL = 3000;
@@ -974,7 +2746,6 @@ nodes:
974
 
975
  const { FatalError, TimeoutError, RepeatNode, NextNode } = DEFINITIONS;
976
  const { ArtWorks, FatalError: ArtWorksError } = require('artworks');
977
- const sharp = require('sharp/lib/index.js');
978
 
979
  const PAAS_BASE_URL = env.variables.get('PAAS_BASE_URL');
980
  if (!PAAS_BASE_URL) {
@@ -996,19 +2767,15 @@ nodes:
996
  });
997
 
998
  if (!state) {
999
- const { image, type, model, prompt, threshold, applyConvexHull } = inputs;
1000
 
1001
  const payload = {
1002
- type: "image-to-mask",
1003
  isFast: true,
1004
  payload: {
1005
  base64: false,
1006
- image,
1007
- type,
1008
  model,
1009
- prompt,
1010
- threshold,
1011
- applyConvexHull,
1012
  },
1013
  };
1014
  try {
@@ -1070,54 +2837,24 @@ nodes:
1070
  },
1071
  });
1072
  }
1073
- const { masks: detected } = results;
1074
- const { image } = inputs;
1075
- const { data } = await download(image);
1076
- const { width, height } = await sharp(data).metadata();
1077
-
1078
- const areas = [];
1079
- const masks = [];
1080
- for (const m of detected) {
1081
- const {
1082
- mask,
1083
- confidence,
1084
- className,
1085
- coordinates: [left, top],
1086
- } = m;
1087
-
1088
- const buffer = Buffer.from(mask, "base64");
1089
-
1090
- areas.push({
1091
- input: buffer,
1092
- top,
1093
- left,
1094
- });
1095
-
1096
- const { width, height } = await sharp(buffer).metadata();
1097
- masks.push({
1098
- top,
1099
- left,
1100
- width,
1101
- height,
1102
- className,
1103
- confidence,
1104
- });
1105
  }
1106
-
1107
- let merged = await sharp({
1108
- create: {
1109
- width,
1110
- height,
1111
- channels: 3,
1112
- background: { r: 0, g: 0, b: 0 },
1113
- },
1114
- }).composite(areas);
1115
- return NextNode.from({
1116
- outputs: {
1117
- masks,
1118
- merged: await merged.png().toBuffer()
1119
- }
1120
- });
1121
  } catch (e) {
1122
  if (e instanceof ArtWorksError) {
1123
  throw new FatalError(e.message);
@@ -1127,14 +2864,15 @@ nodes:
1127
  }
1128
  }
1129
  source: catalog
1130
- title: en=Extract mask on image;ru=Выделить маску
1131
  version: 1
1132
- classify_image:
1133
- _id: classify_image
1134
  arrange:
1135
- x: 1080
1136
- y: 460
1137
  category:
 
1138
  id: image_analysis
1139
  title: en=Image analysis;ru=Анализ изображений
1140
  environment:
@@ -1153,24 +2891,22 @@ nodes:
1153
  inputs:
1154
  image:
1155
  order: 1
1156
- title: Image
1157
  type: image
1158
  required: true
1159
- labels:
1160
  order: 2
1161
- title: Labels
1162
- type: json
1163
  required: true
1164
- default: '{ "girl": "girl on photo", "male": "male on photo" }'
1165
- schema:
1166
- id: image-labels
1167
  outputs:
1168
- labels:
1169
- title: Labels
1170
- type: json
1171
  package: artworks
1172
  script: |-
1173
- const CHECK_TASK_INTERVAL = 1000;
1174
  const MAX_ATTEMPTS = 20;
1175
 
1176
  export async function run({ inputs, state }) {
@@ -1198,15 +2934,18 @@ nodes:
1198
  });
1199
 
1200
  if (!state) {
1201
- const { image, labels } = inputs;
 
 
 
1202
 
1203
  const payload = {
1204
- type: "classify-image",
1205
  isFast: true,
1206
  payload: {
1207
  base64: false,
1208
  image,
1209
- labels: Object.values(labels),
1210
  },
1211
  };
1212
  try {
@@ -1223,7 +2962,7 @@ nodes:
1223
  total: MAX_ATTEMPTS,
1224
  processed: 0
1225
  },
1226
- delay: 2000
1227
  });
1228
  } catch (e) {
1229
  if (e instanceof ArtWorksError) {
@@ -1268,15 +3007,10 @@ nodes:
1268
  },
1269
  });
1270
  }
1271
- let { probs } = results;
1272
- const { labels } = inputs;
1273
- const tags = {};
1274
- for (const key of Object.keys(labels)) {
1275
- tags[key] = probs[labels[key]];
1276
- }
1277
  return NextNode.from({
1278
  outputs: {
1279
- labels: tags
1280
  }
1281
  });
1282
  } catch (e) {
@@ -1288,14 +3022,15 @@ nodes:
1288
  }
1289
  }
1290
  source: catalog
1291
- title: en=Classify image;ru=Тегировать изображение
1292
  version: 1
1293
- detect_face_on_image:
1294
- _id: detect_face_on_image
1295
  arrange:
1296
- x: 900
1297
- y: 330
1298
  category:
 
1299
  id: image_analysis
1300
  title: en=Image analysis;ru=Анализ изображений
1301
  environment:
@@ -1317,88 +3052,14 @@ nodes:
1317
  title: en=Image;ru=Изображение
1318
  type: image
1319
  required: true
1320
- index:
1321
- order: 2
1322
- title: en=Index;ru=Индекс
1323
- type: integer
1324
- required: true
1325
- default: 0
1326
  outputs:
1327
- face:
1328
- title: en=Face;ru=Лицо
1329
- type: image
1330
- features:
1331
- title: en=Features;ru=Характеристики
1332
  type: json
1333
- schema: face-features
1334
  package: artworks
1335
- script: |
1336
- const CHECK_TASK_INTERVAL = 3000;
1337
- const MAX_ATTEMPTS = 10;
1338
-
1339
- const FIT_FACE_SIZE = 512;
1340
-
1341
- export async function fit(image, { maxWidth, maxHeight }) {
1342
- const { width, height } = await image.metadata();
1343
- const orientation = width >= height ? "-" : "|";
1344
-
1345
- const sharp = require('sharp/lib/index.js');
1346
-
1347
- switch (orientation) {
1348
- case "-":
1349
- if (width > maxWidth) {
1350
- return sharp(await image.resize({ width: maxWidth }).toBuffer());
1351
- }
1352
- break;
1353
- case "|":
1354
- if (height > maxHeight) {
1355
- return sharp(await image.resize({ height: maxHeight }).toBuffer());
1356
- }
1357
- break;
1358
- }
1359
-
1360
- return image;
1361
- }
1362
-
1363
- export async function crop(source, face) {
1364
- const sharp = require('sharp/lib/index.js');
1365
-
1366
- const image = await sharp(source);
1367
- const metadata = await image.metadata();
1368
-
1369
- const UNCROP = 0.6;
1370
-
1371
- let { x, y, width, height } = face;
1372
-
1373
- const uncropX = width * UNCROP;
1374
- const uncropY = height * UNCROP;
1375
-
1376
- width = Math.round(width + uncropX);
1377
- height = Math.round(height + uncropY);
1378
- x = Math.round(x - uncropX / 2);
1379
- y = Math.round(y - uncropY / 2);
1380
-
1381
- const [left, top] = [Math.max(x, 0), Math.max(y, 0)];
1382
- [width, height] = [
1383
- Math.min(width, metadata.width - left),
1384
- Math.min(height, metadata.height - top),
1385
- ];
1386
- const size = Math.min(width, height);
1387
-
1388
- const crop = {
1389
- left,
1390
- top,
1391
- width: size,
1392
- height: size,
1393
- };
1394
-
1395
- const area = await fit(await image.clone().extract(crop).webp(), {
1396
- maxWidth: FIT_FACE_SIZE,
1397
- maxHeight: FIT_FACE_SIZE,
1398
- });
1399
-
1400
- return area.toBuffer();
1401
- }
1402
 
1403
  export async function run({ inputs, state }) {
1404
 
@@ -1425,15 +3086,14 @@ nodes:
1425
  });
1426
 
1427
  if (!state) {
1428
- const { image, index } = inputs;
1429
 
1430
  const payload = {
1431
- type: "detect-faces",
1432
  isFast: true,
1433
  payload: {
1434
  base64: false,
1435
- image,
1436
- features: ["age", "gender", "race", "emotion"],
1437
  },
1438
  };
1439
  try {
@@ -1495,30 +3155,10 @@ nodes:
1495
  },
1496
  });
1497
  }
1498
- const { faces } = results;
1499
- const { image, index } = inputs;
1500
- const face = faces[index];
1501
- if (!face) {
1502
- throw new FatalError("Face with such index was not found");
1503
- }
1504
- const { x, y, width, height, ageFrom, ageTo, gender, race, emotion } = face;
1505
- const { data } = await download(image);
1506
  return NextNode.from({
1507
  outputs: {
1508
- face: await crop(data, {
1509
- x,
1510
- y,
1511
- width,
1512
- height,
1513
- }),
1514
- features: {
1515
- ageFrom,
1516
- ageTo,
1517
- gender,
1518
- race,
1519
- emotion,
1520
- },
1521
- },
1522
  });
1523
  } catch (e) {
1524
  if (e instanceof ArtWorksError) {
@@ -1529,16 +3169,17 @@ nodes:
1529
  }
1530
  }
1531
  source: catalog
1532
- title: en=Detect face;ru=Определить лицо
1533
  version: 1
1534
- remove_background:
1535
- _id: remove_background
1536
  arrange:
1537
- x: 750
1538
- y: 630
1539
  category:
1540
- id: image_processing
1541
- title: en=Work with images;ru=Работа с изображениями
 
1542
  environment:
1543
  OPEN_PAAS_USER:
1544
  title: PaaS user
@@ -1558,22 +3199,13 @@ nodes:
1558
  title: en=Image;ru=Изображение
1559
  type: image
1560
  required: true
1561
- model:
1562
- order: 2
1563
- title: en=Model;ru=Модель
1564
- type: string
1565
- required: true
1566
- default: isnet-general-use
1567
- enum:
1568
- - isnet-general-use|IsNet
1569
- - u2net|U2Net
1570
  outputs:
1571
- image:
1572
- title: en=Image;ru=Изображение
1573
- type: image
1574
  package: artworks
1575
  script: |-
1576
- const CHECK_TASK_INTERVAL = 3000;
1577
  const MAX_ATTEMPTS = 20;
1578
 
1579
  export async function run({ inputs, state }) {
@@ -1601,18 +3233,14 @@ nodes:
1601
  });
1602
 
1603
  if (!state) {
1604
- const {
1605
- image,
1606
- model,
1607
- } = inputs;
1608
 
1609
  const payload = {
1610
- type: "remove-image-background",
1611
  isFast: true,
1612
  payload: {
1613
  base64: false,
1614
- model,
1615
- image,
1616
  },
1617
  };
1618
  try {
@@ -1629,7 +3257,7 @@ nodes:
1629
  total: MAX_ATTEMPTS,
1630
  processed: 0
1631
  },
1632
- delay: 5000
1633
  });
1634
  } catch (e) {
1635
  if (e instanceof ArtWorksError) {
@@ -1644,7 +3272,7 @@ nodes:
1644
  attempt,
1645
  startedAt
1646
  } = state;
1647
-
1648
  if (attempt > MAX_ATTEMPTS) {
1649
  try {
1650
  await artworks.cancelTask(task);
@@ -1674,10 +3302,9 @@ nodes:
1674
  },
1675
  });
1676
  }
1677
- let { image: { url: image } } = results;
1678
  return NextNode.from({
1679
  outputs: {
1680
- image
1681
  }
1682
  });
1683
  } catch (e) {
@@ -1689,5 +3316,5 @@ nodes:
1689
  }
1690
  }
1691
  source: catalog
1692
- title: en=Remove background;ru=Удалить фон
1693
  version: 1
 
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: 3
7
  nodes:
8
+ image_to_image_artworks:
9
+ _id: image_to_image_artworks
10
  arrange:
11
+ x: 120
12
+ y: 50
13
  category:
14
+ _id: generate_images
15
  id: generate_images
16
  title: en=Generate images;ru=Генерация изображений
17
+ environment:
18
+ OPEN_PAAS_USER:
19
+ title: PaaS user
20
+ type: string
21
+ scope: global
22
+ OPEN_PAAS_PASSWORD:
23
+ title: PaaS password
24
+ type: string
25
+ scope: global
26
+ PAAS_BASE_URL:
27
+ title: PaaS base url
28
+ type: string
29
+ scope: global
30
  groups:
31
  inputs:
 
 
 
32
  SDXL:
33
  order: 4
34
  title: SDXL checkpoints
 
36
  base:
37
  order: 1
38
  title: en=Base;ru=Базовые параметры
 
 
 
39
  inputs:
40
  image:
41
  order: 1
 
43
  group: base
44
  type: image
45
  required: true
 
 
 
 
46
  prompt:
47
  order: 2
48
  title: en=Prompt;ru=Подсказка
 
127
  - express|⚡ Express
128
  - speed|🚅 Speed
129
  - quality|💎 Quality
 
 
 
 
 
 
 
130
  seed:
131
  order: 10
132
  title: en=Seed;ru=Начальный шум
133
  group: base
134
  type: integer
135
+ placeholder: "-1"
136
  batchSize:
137
  order: 9
138
  title: en=Batch size;ru=Кол-во
 
142
  max: 4
143
  step: 1
144
  default: 1
145
+ sharpness:
 
 
 
 
 
 
146
  order: 1
147
+ title: en=Sharpness;ru=Фотоэффект
148
  group: SDXL
 
 
 
 
 
 
149
  type: integer
150
+ min: 0
151
+ max: 30
152
+ step: 1
153
+ default: 2
154
  outputs:
155
  image1:
156
  title: en=Image 1;ru=Изображение 1
 
209
  performance,
210
  batchSize,
211
  seed,
 
 
 
 
 
212
  // SDXL
213
+ sharpness,
214
  } = inputs;
215
  const payload = {
216
+ type: "image-to-image",
217
  isFast: true,
218
  payload: {
219
  base64: false,
 
239
  performance,
240
  ...(batchSize > 1 ? { batchSize } : {}),
241
  seed,
 
 
 
 
 
242
  // SDXL
243
+ sharpness
244
  },
245
  };
246
  try {
 
322
  }
323
  }
324
  source: catalog
325
+ title: en=Image to image;ru=Пересоздать изображение
326
  version: 1
327
+ generate_image_artworks:
328
+ _id: generate_image_artworks
 
 
 
 
 
 
 
 
 
 
 
 
 
329
  arrange:
330
+ x: 470
331
+ y: 50
332
  category:
333
+ _id: generate_images
334
+ id: generate_images
335
+ title: en=Generate images;ru=Генерация изображений
336
  environment:
337
  OPEN_PAAS_USER:
338
  title: PaaS user
 
346
  title: PaaS base url
347
  type: string
348
  scope: global
349
+ groups:
350
+ inputs:
351
+ SDXL:
352
+ order: 2
353
+ title: SDXL checkpoints
354
+ description: Only for SDXL checkpoints
355
+ base:
356
+ order: 1
357
+ title: en=Base parameters;ru=Базовые параметры
358
  inputs:
359
+ checkpoint:
360
+ order: 2
361
+ title: en=Checkpoint;ru=Модель
362
+ group: base
363
+ type: string
364
+ required: true
365
+ default: juggernautXL_v9Rundiffusionphoto2.safetensors
366
+ enum:
367
+ - raemuXL_v40.safetensors|Raemu XL <SDXL>
368
+ - aamXLAnimeMix_v10.safetensors|AAM XL (Anime Mix) <SDXL> <Fantasy>
369
+ - dreamweaverPony25D.1erv.safetensors|DreamWeaver - Pony 2.5D Mix <SDXL>
370
+ - mixGEMAdam8witQegoow.NeWz.safetensors|MyMIX-G/Jem <SDXL> <Realistic>
371
+ - mfcgPDXL_v10.safetensors|MFCG PDXL <SDXL>
372
+ - aniku_0.2.fp16.safetensors|Anime Desire <SDXL> <Fantasy>
373
+ - flux1DevHyperNF4Flux1DevBNB_flux1DevHyperNF4.safetensors|Hyper NF4 Flux 1 <Flux>
374
+ - STOIQONewrealityFLUXSD_F1DPreAlpha.safetensors|New Reality Flux <Flux>
375
+ - juggernautXL_v9Rundiffusionphoto2.safetensors|Juggernaut XL <SDXL>
376
+ - animaPencilXL_v260.safetensors|Anima Pencil XL <SDXL> <Fantasy>
377
+ - bluePencilXL_v401.safetensors|Blue Pencil XL <SDXL> <Fantasy>
378
+ - pixelArtDiffusionXL_spriteShaper.safetensors|Pixel Art Diffusion XL <SDXL> <Fantasy>
379
+ - albedobaseXL_v20.safetensors|AlbedoBase XL <SDXL>
380
+ - leosamsHelloworldXL_helloworldXL50GPT4V.safetensors|Helloworld XL <SDXL>
381
+ - dynavisionXLAllInOneStylized_releaseV0610Bakedvae.safetensors|DynaVision XL All In One <SDXL>
382
+ - photon_v1.safetensors|Photon <SD 1.5>
383
+ - afroditexlNudePeople_20Bkdvae.safetensors|Nude People <NSFW>
384
+ - nosft-float8-e4m3fn.safetensors|Flux Nude People <NSFW>
385
+ - asdf_0.4a_lorapov_0.2_lust_0.4.fp16.safetensors|Real Porn <NSFW>
386
+ - Sexy_Aesthetic_SDXL_0.4x0.2.fp16.safetensors|Sexy & Beauty <NSFW>
387
+ - aniku_0.2.fp16.safetensors|Anime Desire <NSFW>
388
+ - anikurender_0.4b.fp16.safetensors|Hardcore Fantasy <NSFW>
389
+ prompt:
390
  order: 1
391
+ title: en=Prompt;ru=Подсказка
392
+ group: base
393
+ type: string
394
  required: true
395
+ multiline: true
396
+ default: cat walking on the moon
397
+ imageSize:
398
+ order: 4
399
+ title: en=Size;ru=Размер
400
+ group: base
401
+ type: string
402
+ required: true
403
+ default: 1024x1024
404
+ enum:
405
+ - 512x512|512x512 <SD 1.5>
406
+ - 512x768|512x768 <SD 1.5>
407
+ - 512x912|512x912 <SD 1.5>
408
+ - 576x768|576x768 <SD 1.5>
409
+ - 704x1344|704x1344 <SD 1.5>
410
+ - 704x1408|704x1408 <SD 1.5>
411
+ - 768x512|768x512 <SD 1.5>
412
+ - 768x576|768x576 <SD 1.5>
413
+ - 768x768|768x768 <SD 1.5>
414
+ - 768x1280|768x1280 <SD 1.5>
415
+ - 768x1344|768x1344 <SD 1.5>
416
+ - 832x1152|832x1152 <SD 1.5>
417
+ - 832x1216|832x1216 <SD 1.5>
418
+ - 896x1088|896x1088 <SD 1.5>
419
+ - 896x1152|896x1152 <SD 1.5>
420
+ - 912x512|912x512 <SD 1.5>
421
+ - 960x1024|960x1024 <SDXL> <Flux> <SD 1.5>
422
+ - 960x1088|960x1088 <SDXL> <Flux> <SD 1.5>
423
+ - 1024x1024|1024x1024 <SDXL> <Flux> <SD 1.5>
424
+ - 1024x960|1024x960 <SDXL> <Flux> <SD 1.5>
425
+ - 1088x896|1088x896 <SDXL> <Flux> <SD 1.5>
426
+ - 1088x960|1088x960 <SDXL> <Flux> <SD 1.5>
427
+ - 1152x832|1152x832 <SDXL> <Flux> <SD 1.5>
428
+ - 1152x896|1152x896 <SDXL> <Flux> <SD 1.5>
429
+ - 1216x832|1216x832 <SDXL> <Flux>
430
+ - 1280x768|1280x768 <SDXL> <Flux>
431
+ - 1344x704|1344x704 <SDXL> <Flux>
432
+ - 1344x768|1344x768 <SDXL> <Flux>
433
+ - 1408x704|1408x704 <SDXL> <Flux>
434
+ - 1472x704|1472x704 <SDXL> <Flux>
435
+ - 1536x640|1536x640 <SDXL> <Flux>
436
+ - 1600x640|1600x640 <SDXL> <Flux>
437
+ - 1664x576|1664x576 <SDXL> <Flux>
438
+ - 1728x576|1728x576 <SDXL> <Flux>
439
+ batchSize:
440
+ order: 7
441
+ title: en=Batch size;ru=Кол-во
442
+ group: base
443
+ type: integer
444
+ min: 1
445
+ max: 4
446
+ step: 1
447
+ default: 1
448
+ negativePrompt:
449
+ order: 3
450
+ title: en=Negative prompt;ru=Негативная подсказка
451
+ group: base
452
+ type: string
453
+ multiline: true
454
+ cfgScale:
455
+ order: 5
456
+ title: en=CFG scale;ru=Креативность
457
+ group: base
458
+ type: float
459
  required: true
460
+ min: 1
461
+ max: 20
462
+ step: 1
463
+ default: 7
464
+ performance:
465
+ order: 6
466
+ title: en=Performance;ru=Производительность
467
+ group: base
468
+ type: string
469
+ default: speed
470
+ enum:
471
+ - express|⚡ Express
472
+ - speed|🚅 Speed
473
+ - quality|💎 Quality
474
+ sharpness:
475
+ order: 1
476
+ title: en=Sharpness;ru=Фотоэффект
477
+ group: SDXL
478
+ type: integer
479
+ min: 0
480
+ max: 30
481
+ step: 1
482
+ default: 2
483
+ seed:
484
+ order: 8
485
+ title: en=Seed;ru=Начальный шум
486
+ group: base
487
+ type: integer
488
+ placeholder: "-1"
489
  outputs:
490
+ images:
491
+ title: en=Images;ru=Изображения
492
+ type: image[]
493
+ image1:
494
+ title: en=Image 1;ru=Изображение 1
495
+ type: image
496
+ image2:
497
+ title: en=Image 2;ru=Изображение 2
498
+ type: image
499
+ image3:
500
+ title: en=Image 3;ru=Изображение 3
501
+ type: image
502
+ image4:
503
+ title: en=Image 4;ru=Изображение 4
504
  type: image
505
  package: artworks
506
  script: |
507
  const CHECK_TASK_INTERVAL = 3000;
508
+ const MAX_ATTEMPTS = 100;
509
 
510
  export async function run({ inputs, state }) {
511
 
 
533
 
534
  if (!state) {
535
  const {
536
+ prompt,
537
+ negativePrompt,
538
+ checkpoint,
539
+ cfgScale,
540
+ imageSize: size,
541
+ performance,
542
+ sharpness,
543
+ seed,
544
+ batchSize,
545
+ // SDXL
546
+ styles,
547
  } = inputs;
548
 
549
  const payload = {
550
+ type: "text-to-image",
551
  isFast: true,
552
  payload: {
553
  base64: false,
554
+ prompt,
555
+ ...(!!negativePrompt ? {
556
+ negativePrompt
557
+ } : {}),
558
+ checkpoint,
559
+ cfgScale,
560
+ size,
561
+ ...(performance !== "speed" ? {
562
+ performance
563
+ } : {}),
564
+ ...(seed > 0 ? {
565
+ seed
566
+ } : {}),
567
+ ...(batchSize > 1 ? {
568
+ batchSize
569
+ } : {}),
570
+ // SDXL
571
+ ...(styles?.length > 0 ? {
572
+ styles
573
+ } : {}),
574
+ ...(sharpness > 2 ? {
575
+ sharpness
576
+ } : {}),
577
+ },
578
  };
579
  try {
580
  const task = await artworks.createTask(payload);
 
635
  },
636
  });
637
  }
638
+ let images = results.images.map((i) => i.url);
639
+ const [image1, image2, image3, image4] = images;
640
  return NextNode.from({
641
  outputs: {
642
+ images,
643
+ image1,
644
+ image2,
645
+ image3,
646
+ image4
647
  }
648
  });
649
  } catch (e) {
 
655
  }
656
  }
657
  source: catalog
658
+ title: en=Generate image;ru=Генерация изображения
659
  version: 1
660
+ inpaint_image_artworks:
661
+ _id: inpaint_image_artworks
662
  arrange:
663
  x: 770
664
+ y: 50
665
  category:
666
+ _id: generate_images
667
+ id: generate_images
668
+ title: en=Generate images;ru=Генерация изображений
669
+ environment:
670
+ OPEN_PAAS_USER:
671
+ title: PaaS user
672
  type: string
673
+ scope: global
674
+ OPEN_PAAS_PASSWORD:
675
+ title: PaaS password
676
+ type: string
677
+ scope: global
678
+ PAAS_BASE_URL:
679
+ title: PaaS base url
680
+ type: string
681
+ scope: global
682
+ groups:
683
+ inputs:
684
+ mask:
685
+ order: 2
686
+ title: en=Mask;ru=Маска
687
+ SDXL:
688
+ order: 4
689
+ title: SDXL checkpoints
690
+ description: Only for SDXL checkpoints
691
+ base:
692
+ order: 1
693
+ title: en=Base;ru=Базовые параметры
694
+ special:
695
+ order: 3
696
+ title: en=Special;ru=Специальные возможности
697
+ inputs:
698
+ image:
699
+ order: 1
700
+ title: en=Image;ru=Изображение
701
+ group: base
702
+ type: image
703
+ required: true
704
+ extensions:
705
+ - id: draw-mask
706
+ params:
707
+ mask: mask
708
+ prompt:
709
+ order: 2
710
+ title: en=Prompt;ru=Подсказка
711
+ group: base
712
+ type: string
713
+ required: true
714
+ multiline: true
715
+ negativePrompt:
716
+ order: 4
717
+ title: en=Negative prompt;ru=Негативная подсказка
718
+ group: base
719
+ type: string
720
+ multiline: true
721
+ checkpoint:
722
+ order: 3
723
+ title: en=Checkpoint;ru=Модель
724
+ group: base
725
+ type: string
726
+ required: true
727
+ default: juggernautXL_v9Rundiffusionphoto2.safetensors
728
+ enum:
729
+ - raemuXL_v40.safetensors|Raemu XL <SDXL>
730
+ - aamXLAnimeMix_v10.safetensors|AAM XL (Anime Mix) <SDXL> <Fantasy>
731
+ - dreamweaverPony25D.1erv.safetensors|DreamWeaver - Pony 2.5D Mix <SDXL>
732
+ - mixGEMAdam8witQegoow.NeWz.safetensors|MyMIX-G/Jem <SDXL> <Realistic>
733
+ - mfcgPDXL_v10.safetensors|MFCG PDXL <SDXL>
734
+ - aniku_0.2.fp16.safetensors|Anime Desire <SDXL> <Fantasy>
735
+ - flux1DevHyperNF4Flux1DevBNB_flux1DevHyperNF4.safetensors|Hyper NF4 Flux 1 <Flux>
736
+ - STOIQONewrealityFLUXSD_F1DPreAlpha.safetensors|New Reality Flux <Flux>
737
+ - juggernautXL_v9Rundiffusionphoto2.safetensors|Juggernaut XL <SDXL>
738
+ - animaPencilXL_v260.safetensors|Anima Pencil XL <SDXL> <Fantasy>
739
+ - bluePencilXL_v401.safetensors|Blue Pencil XL <SDXL> <Fantasy>
740
+ - pixelArtDiffusionXL_spriteShaper.safetensors|Pixel Art Diffusion XL <SDXL> <Fantasy>
741
+ - albedobaseXL_v20.safetensors|AlbedoBase XL <SDXL>
742
+ - leosamsHelloworldXL_helloworldXL50GPT4V.safetensors|Helloworld XL <SDXL>
743
+ - dynavisionXLAllInOneStylized_releaseV0610Bakedvae.safetensors|DynaVision XL All In One <SDXL>
744
+ - photon_v1.safetensors|Photon <SD 1.5>
745
+ - afroditexlNudePeople_20Bkdvae.safetensors|Nude People <NSFW>
746
+ - nosft-float8-e4m3fn.safetensors|Flux Nude People <NSFW>
747
+ - asdf_0.4a_lorapov_0.2_lust_0.4.fp16.safetensors|Real Porn <NSFW>
748
+ - Sexy_Aesthetic_SDXL_0.4x0.2.fp16.safetensors|Sexy & Beauty <NSFW>
749
+ - aniku_0.2.fp16.safetensors|Anime Desire <NSFW>
750
+ - anikurender_0.4b.fp16.safetensors|Hardcore Fantasy <NSFW>
751
+ denoisingStrength:
752
+ order: 6
753
+ title: en=Denoising strength;ru=Степень изменения
754
+ group: base
755
+ type: float
756
+ required: true
757
+ min: 0.1
758
+ max: 1
759
+ step: 0.05
760
+ default: 0.5
761
+ cfgScale:
762
+ order: 7
763
+ title: en=CFG scale;ru=Креативность
764
+ group: base
765
+ type: integer
766
+ required: true
767
+ min: 1
768
+ max: 20
769
+ step: 1
770
+ default: 7
771
+ imageSize:
772
+ order: 5
773
+ title: en=Image size;ru=Размер изображения
774
+ group: base
775
+ type: string
776
+ placeholder: auto:auto
777
+ default: auto:auto
778
+ enum:
779
+ - auto:1024
780
+ - 1024:auto
781
+ - auto:auto
782
+ performance:
783
+ order: 8
784
+ title: en=Performance;ru=Производительность
785
+ group: base
786
+ type: string
787
+ default: speed
788
+ enum:
789
+ - express|⚡ Express
790
+ - speed|🚅 Speed
791
+ - quality|💎 Quality
792
+ controlNets:
793
+ order: 1
794
+ title: en=Control nets;ru=Контрольные сети
795
+ group: special
796
+ type: json
797
+ schema:
798
+ id: control-nets
799
+ seed:
800
+ order: 10
801
+ title: en=Seed;ru=Начальный шум
802
+ group: base
803
+ type: integer
804
+ placeholder: "-1"
805
+ batchSize:
806
+ order: 9
807
+ title: en=Batch size;ru=Кол-во
808
+ group: base
809
+ type: integer
810
+ min: 1
811
+ max: 4
812
+ step: 1
813
+ default: 1
814
+ mask:
815
+ order: 1
816
+ title: en=Mask;ru=Маска
817
+ group: mask
818
+ type: image
819
+ required: true
820
+ invertMask:
821
+ order: 1
822
+ title: en=Invert mask;ru=Инвертировать маску
823
+ group: SDXL
824
+ type: boolean
825
+ default: false
826
+ maskMargin:
827
+ order: 2
828
+ title: en=Mask margin;ru=Отступ от маски
829
+ group: mask
830
+ type: integer
831
+ default: 10
832
+ outputs:
833
+ image1:
834
+ title: en=Image 1;ru=Изображение 1
835
+ type: image
836
+ images:
837
+ title: en=Images;ru=Изображения
838
+ type: image[]
839
+ image2:
840
+ title: en=Image 2;ru=Изображение 2
841
+ type: image
842
+ image3:
843
+ title: en=Image 3;ru=Изображение 3
844
+ type: image
845
+ image4:
846
+ title: en=Image 4;ru=Изображение 4
847
+ type: image
848
+ package: artworks
849
+ script: |
850
+ const CHECK_TASK_INTERVAL = 3000;
851
+ const MAX_ATTEMPTS = 100;
852
+
853
+ export async function run({ inputs, state }) {
854
+
855
+ const { FatalError, TimeoutError, RepeatNode, NextNode } = DEFINITIONS;
856
+ const { ArtWorks, fitSize, FatalError: ArtWorksError } = require('artworks');
857
+ const sharp = require('sharp/lib/index.js');
858
+
859
+ const PAAS_BASE_URL = env.variables.get('PAAS_BASE_URL');
860
+ if (!PAAS_BASE_URL) {
861
+ throw new FatalError('Please, set PAAS_BASE_URL in environment');
862
+ }
863
+ const OPEN_PAAS_USER = env.variables.get('OPEN_PAAS_USER');
864
+ if (!OPEN_PAAS_USER) {
865
+ throw new FatalError('Please, set OPEN_PAAS_USER in environment');
866
+ }
867
+ const OPEN_PAAS_PASSWORD = env.variables.get('OPEN_PAAS_PASSWORD');
868
+ if (!OPEN_PAAS_PASSWORD) {
869
+ throw new FatalError('Please, set OPEN_PAAS_PASSWORD in environment');
870
+ }
871
+
872
+ const artworks = new ArtWorks({
873
+ baseUrl: PAAS_BASE_URL,
874
+ username: OPEN_PAAS_USER,
875
+ password: OPEN_PAAS_PASSWORD
876
+ });
877
+
878
+ if (!state) {
879
+ const {
880
+ image,
881
+ prompt,
882
+ checkpoint,
883
+ negativePrompt,
884
+ imageSize,
885
+ denoisingStrength,
886
+ cfgScale,
887
+ performance,
888
+ batchSize,
889
+ seed,
890
+ // mask
891
+ mask,
892
+ maskMargin,
893
+ // special
894
+ controlNets,
895
+ // SDXL
896
+ invertMask,
897
+ } = inputs;
898
+ const payload = {
899
+ type: "inpaint-on-image",
900
+ isFast: true,
901
+ payload: {
902
+ base64: false,
903
+ image,
904
+ prompt,
905
+ checkpoint,
906
+ negativePrompt,
907
+ ...(!!imageSize
908
+ ? await (async () => {
909
+ const { data } = await download(image);
910
+ const buffer = sharp(data);
911
+ const { width, height } = await buffer.metadata();
912
+ if (imageSize !== "auto:auto") {
913
+ const { width: w, height: h } = fitSize(imageSize, height / width);
914
+ return { size: `${w}x${h}` };
915
+ }
916
+
917
+ return {};
918
+ })()
919
+ : {}),
920
+ denoisingStrength,
921
+ cfgScale,
922
+ performance,
923
+ ...(batchSize > 1 ? { batchSize } : {}),
924
+ seed,
925
+ // mask
926
+ mask,
927
+ maskMargin,
928
+ // special
929
+ controlNets,
930
+ // SDXL
931
+ invertMask
932
+ },
933
+ };
934
+ try {
935
+ const task = await artworks.createTask(payload);
936
+ console.log(`Task created ${task}`);
937
+ return RepeatNode.from({
938
+ state: {
939
+ payload,
940
+ task,
941
+ attempt: 0,
942
+ startedAt: new Date()
943
+ },
944
+ progress: {
945
+ total: MAX_ATTEMPTS,
946
+ processed: 0
947
+ },
948
+ delay: 2000
949
+ });
950
+ } catch (e) {
951
+ if (e instanceof ArtWorksError) {
952
+ throw new FatalError(e.message);
953
+ }
954
+ throw e;
955
+ }
956
+ } else {
957
+ const {
958
+ payload,
959
+ task,
960
+ attempt,
961
+ startedAt
962
+ } = state;
963
+
964
+ if (attempt > MAX_ATTEMPTS) {
965
+ try {
966
+ await artworks.cancelTask(task);
967
+ } catch (e) { }
968
+
969
+ const now = new Date();
970
+ const time = (now - new Date(startedAt)) / 1000;
971
+ throw new TimeoutError(`PaaS task for text to image ${task} timeout in ${time} sec`);
972
+ }
973
+
974
+ console.log(`Check task ${attempt} ${task}`);
975
+
976
+ try {
977
+ const results = await artworks.checkState(task);
978
+ if (!results) {
979
+ return RepeatNode.from({
980
+ delay: CHECK_TASK_INTERVAL,
981
+ state: {
982
+ payload,
983
+ task,
984
+ attempt: attempt + 1,
985
+ startedAt,
986
+ },
987
+ progress: {
988
+ total: MAX_ATTEMPTS,
989
+ processed: attempt
990
+ },
991
+ });
992
+ }
993
+ let images = results.images.map((i) => i.url);
994
+ const [image1, image2, image3, image4] = images;
995
+ return NextNode.from({
996
+ outputs: {
997
+ images,
998
+ image1,
999
+ image2,
1000
+ image3,
1001
+ image4
1002
+ }
1003
+ });
1004
+ } catch (e) {
1005
+ if (e instanceof ArtWorksError) {
1006
+ throw new FatalError(e.message);
1007
+ }
1008
+ throw e;
1009
+ }
1010
+ }
1011
+ }
1012
+ source: catalog
1013
+ title: en=Inpaint on image;ru=Улучшить изображение
1014
+ version: 1
1015
+ exctract_mask_on_image_artworks:
1016
+ _id: exctract_mask_on_image_artworks
1017
+ arrange:
1018
+ x: 1070
1019
+ y: 50
1020
+ category:
1021
+ _id: image_analysis
1022
+ id: image_analysis
1023
+ title: en=Image analysis;ru=Анализ изображений
1024
+ environment:
1025
+ OPEN_PAAS_USER:
1026
+ title: PaaS user
1027
+ type: string
1028
+ scope: global
1029
+ OPEN_PAAS_PASSWORD:
1030
+ title: PaaS password
1031
+ type: string
1032
+ scope: global
1033
+ PAAS_BASE_URL:
1034
+ title: PaaS base url
1035
+ type: string
1036
+ scope: global
1037
+ inputs:
1038
+ image:
1039
+ order: 1
1040
+ title: en=Image;ru=Изображение
1041
+ type: image
1042
+ required: true
1043
+ type:
1044
+ order: 2
1045
+ title: en=Type;ru=Тип поиска
1046
+ type: string
1047
+ required: true
1048
+ default: yolo
1049
+ enum:
1050
+ - yolo|Yolo
1051
+ - default|Prompt
1052
+ prompt:
1053
+ order: 4
1054
+ title: en=Prompt;ru=Подсказка
1055
+ type: string
1056
+ required: false
1057
+ multiline: true
1058
+ model:
1059
+ order: 3
1060
+ title: en=Yolo model;ru=Yolo модель
1061
+ type: string
1062
+ required: false
1063
+ default: deepfashion2_yolov8s-seg.pt
1064
+ enum:
1065
+ - deepfashion2_yolov8s-seg.pt
1066
+ - face_yolov8m.pt
1067
+ - face_yolov8n.pt
1068
+ - face_yolov8s.pt
1069
+ - female_breast_v3.2.pt
1070
+ - hand_yolov8n.pt
1071
+ - hand_yolov8s.pt
1072
+ - penisV2.pt
1073
+ - person_yolov8m-seg.pt
1074
+ - person_yolov8n-seg.pt
1075
+ - person_yolov8s-seg.pt
1076
+ - vagina-v2.6.pt
1077
+ threshold:
1078
+ order: 5
1079
+ title: en=Threshold;ru=Чувствительность
1080
+ type: float
1081
+ required: true
1082
+ min: 0.1
1083
+ max: 0.69
1084
+ step: 0.1
1085
+ default: 0.5
1086
+ confidence:
1087
+ order: 6
1088
+ title: en=Confidence;ru=Уверенность
1089
+ type: float
1090
+ required: true
1091
+ min: 0.1
1092
+ max: 0.99
1093
+ step: 0.1
1094
+ default: 0.5
1095
+ applyConvexHull:
1096
+ order: 8
1097
+ title: en=Apply convex hull;ru=Сгладить края
1098
+ type: boolean
1099
+ default: false
1100
+ outputs:
1101
+ merged:
1102
+ title: en=Merged;ru=Общая маска
1103
+ type: image
1104
+ masks:
1105
+ title: en=Masks;ru=Контуры
1106
+ type: json
1107
+ schema: image-masks
1108
+ package: artworks
1109
+ script: |-
1110
+ const CHECK_TASK_INTERVAL = 3000;
1111
+ const MAX_ATTEMPTS = 20;
1112
+
1113
+ export async function run({ inputs, state }) {
1114
+
1115
+ const { FatalError, TimeoutError, RepeatNode, NextNode } = DEFINITIONS;
1116
+ const { ArtWorks, FatalError: ArtWorksError } = require('artworks');
1117
+ const sharp = require('sharp/lib/index.js');
1118
+
1119
+ const PAAS_BASE_URL = env.variables.get('PAAS_BASE_URL');
1120
+ if (!PAAS_BASE_URL) {
1121
+ throw new FatalError('Please, set PAAS_BASE_URL in environment');
1122
+ }
1123
+ const OPEN_PAAS_USER = env.variables.get('OPEN_PAAS_USER');
1124
+ if (!OPEN_PAAS_USER) {
1125
+ throw new FatalError('Please, set OPEN_PAAS_USER in environment');
1126
+ }
1127
+ const OPEN_PAAS_PASSWORD = env.variables.get('OPEN_PAAS_PASSWORD');
1128
+ if (!OPEN_PAAS_PASSWORD) {
1129
+ throw new FatalError('Please, set OPEN_PAAS_PASSWORD in environment');
1130
+ }
1131
+
1132
+ const artworks = new ArtWorks({
1133
+ baseUrl: PAAS_BASE_URL,
1134
+ username: OPEN_PAAS_USER,
1135
+ password: OPEN_PAAS_PASSWORD
1136
+ });
1137
+
1138
+ if (!state) {
1139
+ const { image, type, model, prompt, threshold, applyConvexHull } = inputs;
1140
+
1141
+ const payload = {
1142
+ type: "image-to-mask",
1143
+ isFast: true,
1144
+ payload: {
1145
+ base64: false,
1146
+ image,
1147
+ type,
1148
+ model,
1149
+ prompt,
1150
+ threshold,
1151
+ applyConvexHull,
1152
+ },
1153
+ };
1154
+ try {
1155
+ const task = await artworks.createTask(payload);
1156
+ console.log(`Task created ${task}`);
1157
+ return RepeatNode.from({
1158
+ state: {
1159
+ payload,
1160
+ task,
1161
+ attempt: 0,
1162
+ startedAt: new Date()
1163
+ },
1164
+ progress: {
1165
+ total: MAX_ATTEMPTS,
1166
+ processed: 0
1167
+ },
1168
+ delay: 5000
1169
+ });
1170
+ } catch (e) {
1171
+ if (e instanceof ArtWorksError) {
1172
+ throw new FatalError(e.message);
1173
+ }
1174
+ throw e;
1175
+ }
1176
+ } else {
1177
+ const {
1178
+ payload,
1179
+ task,
1180
+ attempt,
1181
+ startedAt
1182
+ } = state;
1183
+
1184
+ if (attempt > MAX_ATTEMPTS) {
1185
+ try {
1186
+ await artworks.cancelTask(task);
1187
+ } catch (e) { }
1188
+
1189
+ const now = new Date();
1190
+ const time = (now - new Date(startedAt)) / 1000;
1191
+ throw new TimeoutError(`PaaS task for text to image ${task} timeout in ${time} sec`);
1192
+ }
1193
+
1194
+ console.log(`Check task ${attempt} ${task}`);
1195
+
1196
+ try {
1197
+ const results = await artworks.checkState(task);
1198
+ if (!results) {
1199
+ return RepeatNode.from({
1200
+ delay: CHECK_TASK_INTERVAL,
1201
+ state: {
1202
+ payload,
1203
+ task,
1204
+ attempt: attempt + 1,
1205
+ startedAt,
1206
+ },
1207
+ progress: {
1208
+ total: MAX_ATTEMPTS,
1209
+ processed: attempt
1210
+ },
1211
+ });
1212
+ }
1213
+ const { masks: detected } = results;
1214
+ const { image } = inputs;
1215
+ const { data } = await download(image);
1216
+ const { width, height } = await sharp(data).metadata();
1217
+
1218
+ const areas = [];
1219
+ const masks = [];
1220
+ for (const m of detected) {
1221
+ const {
1222
+ mask,
1223
+ confidence,
1224
+ className,
1225
+ coordinates: [left, top],
1226
+ } = m;
1227
+
1228
+ const buffer = Buffer.from(mask, "base64");
1229
+
1230
+ areas.push({
1231
+ input: buffer,
1232
+ top,
1233
+ left,
1234
+ });
1235
+
1236
+ const { width, height } = await sharp(buffer).metadata();
1237
+ masks.push({
1238
+ top,
1239
+ left,
1240
+ width,
1241
+ height,
1242
+ className,
1243
+ confidence,
1244
+ });
1245
+ }
1246
+
1247
+ let merged = await sharp({
1248
+ create: {
1249
+ width,
1250
+ height,
1251
+ channels: 3,
1252
+ background: { r: 0, g: 0, b: 0 },
1253
+ },
1254
+ }).composite(areas);
1255
+ return NextNode.from({
1256
+ outputs: {
1257
+ masks,
1258
+ merged: await merged.png().toBuffer()
1259
+ }
1260
+ });
1261
+ } catch (e) {
1262
+ if (e instanceof ArtWorksError) {
1263
+ throw new FatalError(e.message);
1264
+ }
1265
+ throw e;
1266
+ }
1267
+ }
1268
+ }
1269
+ source: catalog
1270
+ title: en=Extract mask on image;ru=Выделить маску
1271
+ version: 1
1272
+ upscale_image_artworks:
1273
+ _id: upscale_image_artworks
1274
+ arrange:
1275
+ x: 470
1276
+ y: 400
1277
+ category:
1278
+ _id: generate_images
1279
+ id: generate_images
1280
+ title: en=Generate images;ru=Генерация изображений
1281
+ environment:
1282
+ OPEN_PAAS_USER:
1283
+ title: PaaS user
1284
+ type: string
1285
+ scope: global
1286
+ OPEN_PAAS_PASSWORD:
1287
+ title: PaaS password
1288
+ type: string
1289
+ scope: global
1290
+ PAAS_BASE_URL:
1291
+ title: PaaS base url
1292
+ type: string
1293
+ scope: global
1294
+ inputs:
1295
+ image:
1296
+ order: 1
1297
+ title: en=Image;ru=Изображение
1298
+ type: image
1299
+ required: true
1300
+ upscalingResize:
1301
+ order: 2
1302
+ title: en=Resize;ru=Увеличение
1303
+ type: float
1304
+ required: true
1305
+ min: 0.1
1306
+ max: 4
1307
+ step: 0.1
1308
+ default: 2
1309
+ outputs:
1310
+ image:
1311
+ title: en=Image;ru=Изображение
1312
+ type: image
1313
+ package: artworks
1314
+ script: |-
1315
+ const CHECK_TASK_INTERVAL = 3000;
1316
+ const MAX_ATTEMPTS = 20;
1317
+
1318
+ export async function run({ inputs, state }) {
1319
+
1320
+ const { FatalError, TimeoutError, RepeatNode, NextNode } = DEFINITIONS;
1321
+ const { ArtWorks, FatalError: ArtWorksError } = require('artworks');
1322
+
1323
+ const PAAS_BASE_URL = env.variables.get('PAAS_BASE_URL');
1324
+ if (!PAAS_BASE_URL) {
1325
+ throw new FatalError('Please, set PAAS_BASE_URL in environment');
1326
+ }
1327
+ const OPEN_PAAS_USER = env.variables.get('OPEN_PAAS_USER');
1328
+ if (!OPEN_PAAS_USER) {
1329
+ throw new FatalError('Please, set OPEN_PAAS_USER in environment');
1330
+ }
1331
+ const OPEN_PAAS_PASSWORD = env.variables.get('OPEN_PAAS_PASSWORD');
1332
+ if (!OPEN_PAAS_PASSWORD) {
1333
+ throw new FatalError('Please, set OPEN_PAAS_PASSWORD in environment');
1334
+ }
1335
+
1336
+ const artworks = new ArtWorks({
1337
+ baseUrl: PAAS_BASE_URL,
1338
+ username: OPEN_PAAS_USER,
1339
+ password: OPEN_PAAS_PASSWORD
1340
+ });
1341
+
1342
+ if (!state) {
1343
+ const {
1344
+ image,
1345
+ upscalingResize,
1346
+ } = inputs;
1347
+
1348
+ const payload = {
1349
+ type: "upscale-image",
1350
+ isFast: true,
1351
+ payload: {
1352
+ base64: false,
1353
+ image,
1354
+ upscalingResize,
1355
+ },
1356
+ };
1357
+ try {
1358
+ const task = await artworks.createTask(payload);
1359
+ console.log(`Task created ${task}`);
1360
+ return RepeatNode.from({
1361
+ state: {
1362
+ payload,
1363
+ task,
1364
+ attempt: 0,
1365
+ startedAt: new Date()
1366
+ },
1367
+ progress: {
1368
+ total: MAX_ATTEMPTS,
1369
+ processed: 0
1370
+ },
1371
+ delay: 5000
1372
+ });
1373
+ } catch (e) {
1374
+ if (e instanceof ArtWorksError) {
1375
+ throw new FatalError(e.message);
1376
+ }
1377
+ throw e;
1378
+ }
1379
+ } else {
1380
+ const {
1381
+ payload,
1382
+ task,
1383
+ attempt,
1384
+ startedAt
1385
+ } = state;
1386
+
1387
+ if (attempt > MAX_ATTEMPTS) {
1388
+ try {
1389
+ await artworks.cancelTask(task);
1390
+ } catch (e) { }
1391
+
1392
+ const now = new Date();
1393
+ const time = (now - new Date(startedAt)) / 1000;
1394
+ throw new TimeoutError(`PaaS task for text to image ${task} timeout in ${time} sec`);
1395
+ }
1396
+
1397
+ console.log(`Check task ${attempt} ${task}`);
1398
+
1399
+ try {
1400
+ const results = await artworks.checkState(task);
1401
+ if (!results) {
1402
+ return RepeatNode.from({
1403
+ delay: CHECK_TASK_INTERVAL,
1404
+ state: {
1405
+ payload,
1406
+ task,
1407
+ attempt: attempt + 1,
1408
+ startedAt,
1409
+ },
1410
+ progress: {
1411
+ total: MAX_ATTEMPTS,
1412
+ processed: attempt
1413
+ },
1414
+ });
1415
+ }
1416
+ let { image: { url: image } } = results;
1417
+ return NextNode.from({
1418
+ outputs: {
1419
+ image
1420
+ }
1421
+ });
1422
+ } catch (e) {
1423
+ if (e instanceof ArtWorksError) {
1424
+ throw new FatalError(e.message);
1425
+ }
1426
+ throw e;
1427
+ }
1428
+ }
1429
+ }
1430
+ source: catalog
1431
+ title: en=Upscale image;ru=Увеличить изображение
1432
+ version: 1
1433
+ detect_face_on_image_artworks:
1434
+ _id: detect_face_on_image_artworks
1435
+ arrange:
1436
+ x: 1070
1437
+ y: 330
1438
+ category:
1439
+ _id: image_analysis
1440
+ id: image_analysis
1441
+ title: en=Image analysis;ru=Анализ изображений
1442
+ environment:
1443
+ OPEN_PAAS_USER:
1444
+ title: PaaS user
1445
+ type: string
1446
+ scope: global
1447
+ OPEN_PAAS_PASSWORD:
1448
+ title: PaaS password
1449
+ type: string
1450
+ scope: global
1451
+ PAAS_BASE_URL:
1452
+ title: PaaS base url
1453
+ type: string
1454
+ scope: global
1455
+ inputs:
1456
+ image:
1457
+ order: 1
1458
+ title: en=Image;ru=Изображение
1459
+ type: image
1460
+ required: true
1461
+ index:
1462
+ order: 2
1463
+ title: en=Index;ru=Индекс
1464
+ type: integer
1465
+ required: true
1466
+ default: 0
1467
+ outputs:
1468
+ face:
1469
+ title: en=Face;ru=Лицо
1470
+ type: image
1471
+ features:
1472
+ title: en=Features;ru=Характеристики
1473
+ type: json
1474
+ schema: face-features
1475
+ package: artworks
1476
+ script: |
1477
+ const CHECK_TASK_INTERVAL = 3000;
1478
+ const MAX_ATTEMPTS = 10;
1479
+
1480
+ const FIT_FACE_SIZE = 512;
1481
+
1482
+ export async function fit(image, { maxWidth, maxHeight }) {
1483
+ const { width, height } = await image.metadata();
1484
+ const orientation = width >= height ? "-" : "|";
1485
+
1486
+ const sharp = require('sharp/lib/index.js');
1487
+
1488
+ switch (orientation) {
1489
+ case "-":
1490
+ if (width > maxWidth) {
1491
+ return sharp(await image.resize({ width: maxWidth }).toBuffer());
1492
+ }
1493
+ break;
1494
+ case "|":
1495
+ if (height > maxHeight) {
1496
+ return sharp(await image.resize({ height: maxHeight }).toBuffer());
1497
+ }
1498
+ break;
1499
+ }
1500
+
1501
+ return image;
1502
+ }
1503
+
1504
+ export async function crop(source, face) {
1505
+ const sharp = require('sharp/lib/index.js');
1506
+
1507
+ const image = await sharp(source);
1508
+ const metadata = await image.metadata();
1509
+
1510
+ const UNCROP = 0.6;
1511
+
1512
+ let { x, y, width, height } = face;
1513
+
1514
+ const uncropX = width * UNCROP;
1515
+ const uncropY = height * UNCROP;
1516
+
1517
+ width = Math.round(width + uncropX);
1518
+ height = Math.round(height + uncropY);
1519
+ x = Math.round(x - uncropX / 2);
1520
+ y = Math.round(y - uncropY / 2);
1521
+
1522
+ const [left, top] = [Math.max(x, 0), Math.max(y, 0)];
1523
+ [width, height] = [
1524
+ Math.min(width, metadata.width - left),
1525
+ Math.min(height, metadata.height - top),
1526
+ ];
1527
+ const size = Math.min(width, height);
1528
+
1529
+ const crop = {
1530
+ left,
1531
+ top,
1532
+ width: size,
1533
+ height: size,
1534
+ };
1535
+
1536
+ const area = await fit(await image.clone().extract(crop).webp(), {
1537
+ maxWidth: FIT_FACE_SIZE,
1538
+ maxHeight: FIT_FACE_SIZE,
1539
+ });
1540
+
1541
+ return area.toBuffer();
1542
+ }
1543
+
1544
+ export async function run({ inputs, state }) {
1545
+
1546
+ const { FatalError, TimeoutError, RepeatNode, NextNode } = DEFINITIONS;
1547
+ const { ArtWorks, FatalError: ArtWorksError } = require('artworks');
1548
+
1549
+ const PAAS_BASE_URL = env.variables.get('PAAS_BASE_URL');
1550
+ if (!PAAS_BASE_URL) {
1551
+ throw new FatalError('Please, set PAAS_BASE_URL in environment');
1552
+ }
1553
+ const OPEN_PAAS_USER = env.variables.get('OPEN_PAAS_USER');
1554
+ if (!OPEN_PAAS_USER) {
1555
+ throw new FatalError('Please, set OPEN_PAAS_USER in environment');
1556
+ }
1557
+ const OPEN_PAAS_PASSWORD = env.variables.get('OPEN_PAAS_PASSWORD');
1558
+ if (!OPEN_PAAS_PASSWORD) {
1559
+ throw new FatalError('Please, set OPEN_PAAS_PASSWORD in environment');
1560
+ }
1561
+
1562
+ const artworks = new ArtWorks({
1563
+ baseUrl: PAAS_BASE_URL,
1564
+ username: OPEN_PAAS_USER,
1565
+ password: OPEN_PAAS_PASSWORD
1566
+ });
1567
+
1568
+ if (!state) {
1569
+ const { image, index } = inputs;
1570
+
1571
+ const payload = {
1572
+ type: "detect-faces",
1573
+ isFast: true,
1574
+ payload: {
1575
+ base64: false,
1576
+ image,
1577
+ features: ["age", "gender", "race", "emotion"],
1578
+ },
1579
+ };
1580
+ try {
1581
+ const task = await artworks.createTask(payload);
1582
+ console.log(`Task created ${task}`);
1583
+ return RepeatNode.from({
1584
+ state: {
1585
+ payload,
1586
+ task,
1587
+ attempt: 0,
1588
+ startedAt: new Date()
1589
+ },
1590
+ progress: {
1591
+ total: MAX_ATTEMPTS,
1592
+ processed: 0
1593
+ },
1594
+ delay: 2000
1595
+ });
1596
+ } catch (e) {
1597
+ if (e instanceof ArtWorksError) {
1598
+ throw new FatalError(e.message);
1599
+ }
1600
+ throw e;
1601
+ }
1602
+ } else {
1603
+ const {
1604
+ payload,
1605
+ task,
1606
+ attempt,
1607
+ startedAt
1608
+ } = state;
1609
+
1610
+ if (attempt > MAX_ATTEMPTS) {
1611
+ try {
1612
+ await artworks.cancelTask(task);
1613
+ } catch (e) { }
1614
+
1615
+ const now = new Date();
1616
+ const time = (now - new Date(startedAt)) / 1000;
1617
+ throw new TimeoutError(`PaaS task for text to image ${task} timeout in ${time} sec`);
1618
+ }
1619
+
1620
+ console.log(`Check task ${attempt} ${task}`);
1621
+
1622
+ try {
1623
+ const results = await artworks.checkState(task);
1624
+ if (!results) {
1625
+ return RepeatNode.from({
1626
+ delay: CHECK_TASK_INTERVAL,
1627
+ state: {
1628
+ payload,
1629
+ task,
1630
+ attempt: attempt + 1,
1631
+ startedAt,
1632
+ },
1633
+ progress: {
1634
+ total: MAX_ATTEMPTS,
1635
+ processed: attempt
1636
+ },
1637
+ });
1638
+ }
1639
+ const { faces } = results;
1640
+ const { image, index } = inputs;
1641
+ const face = faces[index];
1642
+ if (!face) {
1643
+ throw new FatalError("Face with such index was not found");
1644
+ }
1645
+ const { x, y, width, height, ageFrom, ageTo, gender, race, emotion } = face;
1646
+ const { data } = await download(image);
1647
+ return NextNode.from({
1648
+ outputs: {
1649
+ face: await crop(data, {
1650
+ x,
1651
+ y,
1652
+ width,
1653
+ height,
1654
+ }),
1655
+ features: {
1656
+ ageFrom,
1657
+ ageTo,
1658
+ gender,
1659
+ race,
1660
+ emotion,
1661
+ },
1662
+ },
1663
+ });
1664
+ } catch (e) {
1665
+ if (e instanceof ArtWorksError) {
1666
+ throw new FatalError(e.message);
1667
+ }
1668
+ throw e;
1669
+ }
1670
+ }
1671
+ }
1672
+ source: catalog
1673
+ title: en=Detect face;ru=Определить лицо
1674
+ version: 1
1675
+ classify_image_artworks:
1676
+ _id: classify_image_artworks
1677
+ arrange:
1678
+ x: 1070
1679
+ y: 460
1680
+ category:
1681
+ _id: image_analysis
1682
+ id: image_analysis
1683
+ title: en=Image analysis;ru=Анализ изображений
1684
+ environment:
1685
+ OPEN_PAAS_USER:
1686
+ title: PaaS user
1687
+ type: string
1688
+ scope: global
1689
+ OPEN_PAAS_PASSWORD:
1690
+ title: PaaS password
1691
+ type: string
1692
+ scope: global
1693
+ PAAS_BASE_URL:
1694
+ title: PaaS base url
1695
+ type: string
1696
+ scope: global
1697
+ inputs:
1698
+ image:
1699
+ order: 1
1700
+ title: en=Image;ru=Изображение
1701
+ type: image
1702
+ required: true
1703
+ labels:
1704
+ order: 2
1705
+ title: en=Labels;ru=Теги
1706
+ type: json
1707
+ required: true
1708
+ default: '{ "girl": "girl on photo", "male": "male on photo" }'
1709
+ schema:
1710
+ id: image-labels
1711
+ outputs:
1712
+ labels:
1713
+ title: en=Labels;ru=Теги
1714
+ type: json
1715
+ package: artworks
1716
+ script: |-
1717
+ const CHECK_TASK_INTERVAL = 1000;
1718
+ const MAX_ATTEMPTS = 20;
1719
+
1720
+ export async function run({ inputs, state }) {
1721
+
1722
+ const { FatalError, TimeoutError, RepeatNode, NextNode } = DEFINITIONS;
1723
+ const { ArtWorks, FatalError: ArtWorksError } = require('artworks');
1724
+
1725
+ const PAAS_BASE_URL = env.variables.get('PAAS_BASE_URL');
1726
+ if (!PAAS_BASE_URL) {
1727
+ throw new FatalError('Please, set PAAS_BASE_URL in environment');
1728
+ }
1729
+ const OPEN_PAAS_USER = env.variables.get('OPEN_PAAS_USER');
1730
+ if (!OPEN_PAAS_USER) {
1731
+ throw new FatalError('Please, set OPEN_PAAS_USER in environment');
1732
+ }
1733
+ const OPEN_PAAS_PASSWORD = env.variables.get('OPEN_PAAS_PASSWORD');
1734
+ if (!OPEN_PAAS_PASSWORD) {
1735
+ throw new FatalError('Please, set OPEN_PAAS_PASSWORD in environment');
1736
+ }
1737
+
1738
+ const artworks = new ArtWorks({
1739
+ baseUrl: PAAS_BASE_URL,
1740
+ username: OPEN_PAAS_USER,
1741
+ password: OPEN_PAAS_PASSWORD
1742
+ });
1743
+
1744
+ if (!state) {
1745
+ const { image, labels } = inputs;
1746
+
1747
+ const payload = {
1748
+ type: "classify-image",
1749
+ isFast: true,
1750
+ payload: {
1751
+ base64: false,
1752
+ image,
1753
+ labels: Object.values(labels),
1754
+ },
1755
+ };
1756
+ try {
1757
+ const task = await artworks.createTask(payload);
1758
+ console.log(`Task created ${task}`);
1759
+ return RepeatNode.from({
1760
+ state: {
1761
+ payload,
1762
+ task,
1763
+ attempt: 0,
1764
+ startedAt: new Date()
1765
+ },
1766
+ progress: {
1767
+ total: MAX_ATTEMPTS,
1768
+ processed: 0
1769
+ },
1770
+ delay: 2000
1771
+ });
1772
+ } catch (e) {
1773
+ if (e instanceof ArtWorksError) {
1774
+ throw new FatalError(e.message);
1775
+ }
1776
+ throw e;
1777
+ }
1778
+ } else {
1779
+ const {
1780
+ payload,
1781
+ task,
1782
+ attempt,
1783
+ startedAt
1784
+ } = state;
1785
+
1786
+ if (attempt > MAX_ATTEMPTS) {
1787
+ try {
1788
+ await artworks.cancelTask(task);
1789
+ } catch (e) { }
1790
+
1791
+ const now = new Date();
1792
+ const time = (now - new Date(startedAt)) / 1000;
1793
+ throw new TimeoutError(`PaaS task for text to image ${task} timeout in ${time} sec`);
1794
+ }
1795
+
1796
+ console.log(`Check task ${attempt} ${task}`);
1797
+
1798
+ try {
1799
+ const results = await artworks.checkState(task);
1800
+ if (!results) {
1801
+ return RepeatNode.from({
1802
+ delay: CHECK_TASK_INTERVAL,
1803
+ state: {
1804
+ payload,
1805
+ task,
1806
+ attempt: attempt + 1,
1807
+ startedAt,
1808
+ },
1809
+ progress: {
1810
+ total: MAX_ATTEMPTS,
1811
+ processed: attempt
1812
+ },
1813
+ });
1814
+ }
1815
+ let { probs } = results;
1816
+ const { labels } = inputs;
1817
+ const tags = {};
1818
+ for (const key of Object.keys(labels)) {
1819
+ tags[key] = probs[labels[key]];
1820
+ }
1821
+ return NextNode.from({
1822
+ outputs: {
1823
+ labels: tags
1824
+ }
1825
+ });
1826
+ } catch (e) {
1827
+ if (e instanceof ArtWorksError) {
1828
+ throw new FatalError(e.message);
1829
+ }
1830
+ throw e;
1831
+ }
1832
+ }
1833
+ }
1834
+ source: catalog
1835
+ title: en=Classify image;ru=Тегировать изображение
1836
+ version: 1
1837
+ translate_text_artworks:
1838
+ _id: translate_text_artworks
1839
+ arrange:
1840
+ x: 110
1841
+ y: 620
1842
+ category:
1843
+ _id: process_text
1844
+ id: process_text
1845
+ title: en=Process text;ru=Обработка текста
1846
+ environment:
1847
+ OPEN_PAAS_USER:
1848
+ title: PaaS user
1849
+ type: string
1850
+ scope: global
1851
+ OPEN_PAAS_PASSWORD:
1852
+ title: PaaS password
1853
+ type: string
1854
+ scope: global
1855
+ PAAS_BASE_URL:
1856
+ title: PaaS base url
1857
+ type: string
1858
+ scope: global
1859
+ inputs:
1860
+ source:
1861
+ order: 1
1862
+ title: en=Source language;ru=Исходный язык
1863
+ type: string
1864
+ required: true
1865
+ default: auto
1866
+ enum:
1867
+ - auto|Auto
1868
+ - en|English
1869
+ - de|German
1870
+ - ru|Russian
1871
+ - es|Spanish
1872
+ - fr|French
1873
+ - it|Italian
1874
+ - pt|Portuguese
1875
+ - ja|Japanese
1876
+ - ko|Korean
1877
  - hi|Hindi
1878
  - tr|Turkish
1879
  - zh|Chinese Simplified
1880
  target:
1881
  order: 2
1882
+ title: en=Target;ru=Целевой язык
1883
  description: github://generative-core/piper/main/docs/nodes/translate-text/target.md
1884
  type: string
1885
+ required: true
1886
+ default: de
1887
+ enum:
1888
+ - en|English
1889
+ - de|German
1890
+ - ru|Russian
1891
+ - es|Spanish
1892
+ - fr|French
1893
+ - it|Italian
1894
+ - pt|Portuguese
1895
+ - ja|Japanese
1896
+ - ko|Korean
1897
+ - hi|Hindi
1898
+ - tr|Turkish
1899
+ - zh|Chinese Simplified
1900
+ text:
1901
+ order: 3
1902
+ title: en=Text;ru=Текст
1903
+ type: string
1904
+ required: true
1905
+ multiline: true
1906
+ outputs:
1907
+ text:
1908
+ title: en=Text;ru=Перевод
1909
+ type: string
1910
+ alternatives:
1911
+ title: en=Alternatives;ru=Альтернативы
1912
+ type: string[]
1913
+ detectedLanguage:
1914
+ title: en=Detected language;ru=Исходный язык
1915
+ type: json
1916
+ schema: detected-languages
1917
+ package: artworks
1918
+ script: |
1919
+ const CHECK_TASK_INTERVAL = 3000;
1920
+ const MAX_ATTEMPTS = 10;
1921
+
1922
+ export async function run({ inputs, state }) {
1923
+
1924
+ const { FatalError, TimeoutError, RepeatNode, NextNode } = DEFINITIONS;
1925
+ const { ArtWorks, FatalError: ArtWorksError } = require('artworks');
1926
+
1927
+ const PAAS_BASE_URL = env.variables.get('PAAS_BASE_URL');
1928
+ if (!PAAS_BASE_URL) {
1929
+ throw new FatalError('Please, set PAAS_BASE_URL in environment');
1930
+ }
1931
+ const OPEN_PAAS_USER = env.variables.get('OPEN_PAAS_USER');
1932
+ if (!OPEN_PAAS_USER) {
1933
+ throw new FatalError('Please, set OPEN_PAAS_USER in environment');
1934
+ }
1935
+ const OPEN_PAAS_PASSWORD = env.variables.get('OPEN_PAAS_PASSWORD');
1936
+ if (!OPEN_PAAS_PASSWORD) {
1937
+ throw new FatalError('Please, set OPEN_PAAS_PASSWORD in environment');
1938
+ }
1939
+
1940
+ const artworks = new ArtWorks({
1941
+ baseUrl: PAAS_BASE_URL,
1942
+ username: OPEN_PAAS_USER,
1943
+ password: OPEN_PAAS_PASSWORD
1944
+ });
1945
+
1946
+ if (!state) {
1947
+ const { source, target, text } = inputs;
1948
+
1949
+ const payload = {
1950
+ type: "translate-text",
1951
+ isFast: true,
1952
+ payload: {
1953
+ source,
1954
+ target,
1955
+ text,
1956
+ },
1957
+ };
1958
+ try {
1959
+ const task = await artworks.createTask(payload);
1960
+ console.log(`Task created ${task}`);
1961
+ return RepeatNode.from({
1962
+ state: {
1963
+ payload,
1964
+ task,
1965
+ attempt: 0,
1966
+ startedAt: new Date()
1967
+ },
1968
+ progress: {
1969
+ total: MAX_ATTEMPTS,
1970
+ processed: 0
1971
+ },
1972
+ delay: 2000
1973
+ });
1974
+ } catch (e) {
1975
+ if (e instanceof ArtWorksError) {
1976
+ throw new FatalError(e.message);
1977
+ }
1978
+ throw e;
1979
+ }
1980
+ } else {
1981
+ const {
1982
+ payload,
1983
+ task,
1984
+ attempt,
1985
+ startedAt
1986
+ } = state;
1987
+
1988
+ if (attempt > MAX_ATTEMPTS) {
1989
+ try {
1990
+ await artworks.cancelTask(task);
1991
+ } catch (e) { }
1992
+
1993
+ const now = new Date();
1994
+ const time = (now - new Date(startedAt)) / 1000;
1995
+ throw new TimeoutError(`PaaS task for text to image ${task} timeout in ${time} sec`);
1996
+ }
1997
+
1998
+ console.log(`Check task ${attempt} ${task}`);
1999
+
2000
+ try {
2001
+ const results = await artworks.checkState(task);
2002
+ if (!results) {
2003
+ return RepeatNode.from({
2004
+ delay: CHECK_TASK_INTERVAL,
2005
+ state: {
2006
+ payload,
2007
+ task,
2008
+ attempt: attempt + 1,
2009
+ startedAt,
2010
+ },
2011
+ progress: {
2012
+ total: MAX_ATTEMPTS,
2013
+ processed: attempt
2014
+ },
2015
+ });
2016
+ }
2017
+ console.log(results);
2018
+ const { alternatives, detectedLanguage, text } = results;
2019
+ return NextNode.from({
2020
+ outputs: {
2021
+ alternatives,
2022
+ detectedLanguage,
2023
+ text
2024
+ }
2025
+ });
2026
+ } catch (e) {
2027
+ if (e instanceof ArtWorksError) {
2028
+ throw new FatalError(e.message);
2029
+ }
2030
+ throw e;
2031
+ }
2032
+ }
2033
+ }
2034
+ source: catalog
2035
+ title: en=Translate text;ru=Перевести текст
2036
+ version: 1
2037
+ face_swap_on_image_artworks:
2038
+ _id: face_swap_on_image_artworks
2039
+ arrange:
2040
+ x: 440
2041
+ y: 630
2042
+ category:
2043
+ _id: deep_swap
2044
+ id: deep_swap
2045
+ title: en=Deep swap;ru=Глубокая замена
2046
+ environment:
2047
+ OPEN_PAAS_USER:
2048
+ title: PaaS user
2049
+ type: string
2050
+ scope: global
2051
+ OPEN_PAAS_PASSWORD:
2052
+ title: PaaS password
2053
+ type: string
2054
+ scope: global
2055
+ PAAS_BASE_URL:
2056
+ title: PaaS base url
2057
  type: string
2058
+ scope: global
2059
+ inputs:
2060
+ face:
2061
+ order: 1
2062
+ title: en=Face;ru=Лицо
2063
+ type: image
2064
+ required: true
2065
+ image:
2066
+ order: 2
2067
+ title: en=Image;ru=Изображение
2068
+ type: image
2069
  required: true
 
2070
  outputs:
2071
+ image:
2072
+ title: en=Image;ru=Изображение
2073
+ type: image
 
 
 
 
 
 
 
2074
  package: artworks
2075
+ script: |
2076
+ const CHECK_TASK_INTERVAL = 3000;
2077
+ const MAX_ATTEMPTS = 20;
2078
+
2079
+ export async function costs({ inputs }) {
2080
+ return 0.1;
2081
+ }
2082
+
2083
+ export async function run({ inputs, state }) {
2084
+
2085
+ const { FatalError, TimeoutError, RepeatNode, NextNode } = DEFINITIONS;
2086
+ const { ArtWorks, FatalError: ArtWorksError } = require('artworks');
2087
+
2088
+ const PAAS_BASE_URL = env.variables.get('PAAS_BASE_URL');
2089
+ if (!PAAS_BASE_URL) {
2090
+ throw new FatalError('Please, set PAAS_BASE_URL in environment');
2091
+ }
2092
+ const OPEN_PAAS_USER = env.variables.get('OPEN_PAAS_USER');
2093
+ if (!OPEN_PAAS_USER) {
2094
+ throw new FatalError('Please, set OPEN_PAAS_USER in environment');
2095
+ }
2096
+ const OPEN_PAAS_PASSWORD = env.variables.get('OPEN_PAAS_PASSWORD');
2097
+ if (!OPEN_PAAS_PASSWORD) {
2098
+ throw new FatalError('Please, set OPEN_PAAS_PASSWORD in environment');
2099
+ }
2100
+
2101
+ const artworks = new ArtWorks({
2102
+ baseUrl: PAAS_BASE_URL,
2103
+ username: OPEN_PAAS_USER,
2104
+ password: OPEN_PAAS_PASSWORD
2105
+ });
2106
+
2107
+ if (!state) {
2108
+ const {
2109
+ face,
2110
+ image
2111
+ } = inputs;
2112
+
2113
+ const payload = {
2114
+ type: "faceswap-on-image",
2115
+ isFast: true,
2116
+ payload: {
2117
+ base64: false,
2118
+ face,
2119
+ image,
2120
+ }
2121
+ };
2122
+ try {
2123
+ const task = await artworks.createTask(payload);
2124
+ console.log(`Task created ${task}`);
2125
+ return RepeatNode.from({
2126
+ state: {
2127
+ payload,
2128
+ task,
2129
+ attempt: 0,
2130
+ startedAt: new Date()
2131
+ },
2132
+ progress: {
2133
+ total: MAX_ATTEMPTS,
2134
+ processed: 0
2135
+ },
2136
+ delay: 2000
2137
+ });
2138
+ } catch (e) {
2139
+ if (e instanceof ArtWorksError) {
2140
+ throw new FatalError(e.message);
2141
+ }
2142
+ throw e;
2143
+ }
2144
+ } else {
2145
+ const {
2146
+ payload,
2147
+ task,
2148
+ attempt,
2149
+ startedAt
2150
+ } = state;
2151
+
2152
+ if (attempt > MAX_ATTEMPTS) {
2153
+ try {
2154
+ await artworks.cancelTask(task);
2155
+ } catch (e) { }
2156
+
2157
+ const now = new Date();
2158
+ const time = (now - new Date(startedAt)) / 1000;
2159
+ throw new TimeoutError(`PaaS task for text to image ${task} timeout in ${time} sec`);
2160
+ }
2161
+
2162
+ console.log(`Check task ${attempt} ${task}`);
2163
+
2164
+ try {
2165
+ const results = await artworks.checkState(task);
2166
+ if (!results) {
2167
+ return RepeatNode.from({
2168
+ delay: CHECK_TASK_INTERVAL,
2169
+ state: {
2170
+ payload,
2171
+ task,
2172
+ attempt: attempt + 1,
2173
+ startedAt,
2174
+ },
2175
+ progress: {
2176
+ total: MAX_ATTEMPTS,
2177
+ processed: attempt
2178
+ },
2179
+ });
2180
+ }
2181
+ let { images: [{ url: image }] } = results;
2182
+ return NextNode.from({
2183
+ outputs: {
2184
+ image
2185
+ },
2186
+ costs: costs({ inputs })
2187
+ });
2188
+ } catch (e) {
2189
+ if (e instanceof ArtWorksError) {
2190
+ throw new FatalError(e.message);
2191
+ }
2192
+ throw e;
2193
+ }
2194
+ }
2195
+ }
2196
  source: catalog
2197
+ title: en=Face swap on image;ru=Замена лица на изображении
2198
  version: 1
2199
+ remove_background_artworks:
2200
+ _id: remove_background_artworks
2201
+ arrange:
2202
+ x: 750
2203
+ y: 630
2204
+ category:
2205
+ _id: image_processing
2206
+ id: image_processing
2207
+ title: en=Work with images;ru=Работа с изображениями
2208
  environment:
2209
  OPEN_PAAS_USER:
2210
  title: PaaS user
 
2217
  PAAS_BASE_URL:
2218
  title: PaaS base url
2219
  type: string
2220
+ scope: global
2221
+ inputs:
2222
+ image:
2223
+ order: 1
2224
+ title: en=Image;ru=Изображение
2225
+ type: image
2226
+ required: true
2227
+ model:
2228
+ order: 2
2229
+ title: en=Model;ru=Модель
2230
+ type: string
2231
+ required: true
2232
+ default: isnet-general-use
2233
+ enum:
2234
+ - isnet-general-use|IsNet
2235
+ - u2net|U2Net
2236
+ outputs:
2237
+ image:
2238
+ title: en=Image;ru=Изображение
2239
+ type: image
2240
+ package: artworks
2241
+ script: |-
2242
  const CHECK_TASK_INTERVAL = 3000;
2243
+ const MAX_ATTEMPTS = 20;
2244
 
2245
  export async function run({ inputs, state }) {
2246
 
 
2267
  });
2268
 
2269
  if (!state) {
2270
+ const {
2271
+ image,
2272
+ model,
2273
+ } = inputs;
2274
 
2275
  const payload = {
2276
+ type: "remove-image-background",
2277
  isFast: true,
2278
  payload: {
2279
+ base64: false,
2280
+ model,
2281
+ image,
2282
  },
2283
  };
2284
  try {
 
2295
  total: MAX_ATTEMPTS,
2296
  processed: 0
2297
  },
2298
+ delay: 5000
2299
  });
2300
  } catch (e) {
2301
  if (e instanceof ArtWorksError) {
 
2310
  attempt,
2311
  startedAt
2312
  } = state;
2313
+
2314
  if (attempt > MAX_ATTEMPTS) {
2315
  try {
2316
  await artworks.cancelTask(task);
 
2340
  },
2341
  });
2342
  }
2343
+ let { image: { url: image } } = results;
 
2344
  return NextNode.from({
2345
  outputs: {
2346
+ image
 
 
2347
  }
2348
  });
2349
  } catch (e) {
 
2354
  }
2355
  }
2356
  }
2357
+ source: catalog
2358
+ title: en=Remove background;ru=Удалить фон
2359
+ version: 1
2360
+ outpaint_image_artworks:
2361
+ _id: outpaint_image_artworks
2362
  arrange:
2363
+ x: 1070
2364
+ y: 630
2365
  category:
2366
+ _id: generate_images
2367
  id: generate_images
2368
  title: en=Generate images;ru=Генерация изображений
2369
  environment:
 
2379
  title: PaaS base url
2380
  type: string
2381
  scope: global
2382
+ groups:
2383
+ inputs:
2384
+ base:
2385
+ order: 1
2386
+ title: en=Base;ru=Базовые параметры
2387
+ distance:
2388
+ order: 2
2389
+ title: en=Distance;ru=Расширение
2390
  inputs:
2391
  image:
2392
  order: 1
2393
+ title: en=Image;ru=Изображение
2394
+ group: base
2395
  type: image
2396
  required: true
2397
+ prompt:
2398
  order: 2
2399
+ title: en=Prompt;ru=Подсказка
2400
+ group: base
2401
+ type: string
2402
+ required: true
2403
+ multiline: true
2404
+ negativePrompt:
2405
+ order: 4
2406
+ title: en=Negative prompt;ru=Негативная подсказка
2407
+ group: base
2408
+ type: string
2409
+ multiline: true
2410
+ checkpoint:
2411
+ order: 3
2412
+ title: en=Checkpoint;ru=Модель
2413
+ group: base
2414
+ type: string
2415
+ required: true
2416
+ default: juggernautXL_v9Rundiffusionphoto2.safetensors
2417
+ enum:
2418
+ - raemuXL_v40.safetensors|Raemu XL <SDXL>
2419
+ - aamXLAnimeMix_v10.safetensors|AAM XL (Anime Mix) <SDXL> <Fantasy>
2420
+ - dreamweaverPony25D.1erv.safetensors|DreamWeaver - Pony 2.5D Mix <SDXL>
2421
+ - mixGEMAdam8witQegoow.NeWz.safetensors|MyMIX-G/Jem <SDXL> <Realistic>
2422
+ - mfcgPDXL_v10.safetensors|MFCG PDXL <SDXL>
2423
+ - aniku_0.2.fp16.safetensors|Anime Desire <SDXL> <Fantasy>
2424
+ - flux1DevHyperNF4Flux1DevBNB_flux1DevHyperNF4.safetensors|Hyper NF4 Flux 1 <Flux>
2425
+ - STOIQONewrealityFLUXSD_F1DPreAlpha.safetensors|New Reality Flux <Flux>
2426
+ - juggernautXL_v9Rundiffusionphoto2.safetensors|Juggernaut XL <SDXL>
2427
+ - animaPencilXL_v260.safetensors|Anima Pencil XL <SDXL> <Fantasy>
2428
+ - bluePencilXL_v401.safetensors|Blue Pencil XL <SDXL> <Fantasy>
2429
+ - pixelArtDiffusionXL_spriteShaper.safetensors|Pixel Art Diffusion XL <SDXL> <Fantasy>
2430
+ - albedobaseXL_v20.safetensors|AlbedoBase XL <SDXL>
2431
+ - leosamsHelloworldXL_helloworldXL50GPT4V.safetensors|Helloworld XL <SDXL>
2432
+ - dynavisionXLAllInOneStylized_releaseV0610Bakedvae.safetensors|DynaVision XL All In One <SDXL>
2433
+ - photon_v1.safetensors|Photon <SD 1.5>
2434
+ - afroditexlNudePeople_20Bkdvae.safetensors|Nude People <NSFW>
2435
+ - nosft-float8-e4m3fn.safetensors|Flux Nude People <NSFW>
2436
+ - asdf_0.4a_lorapov_0.2_lust_0.4.fp16.safetensors|Real Porn <NSFW>
2437
+ - Sexy_Aesthetic_SDXL_0.4x0.2.fp16.safetensors|Sexy & Beauty <NSFW>
2438
+ - aniku_0.2.fp16.safetensors|Anime Desire <NSFW>
2439
+ - anikurender_0.4b.fp16.safetensors|Hardcore Fantasy <NSFW>
2440
+ denoisingStrength:
2441
+ order: 5
2442
+ title: en=Denoising strength;ru=Степень изменения
2443
+ group: base
2444
  type: float
2445
  required: true
2446
  min: 0.1
2447
+ max: 1
2448
+ step: 0.05
2449
+ default: 0.5
2450
+ cfgScale:
2451
+ order: 6
2452
+ title: en=CFG scale;ru=Креативность
2453
+ group: base
2454
+ type: integer
2455
+ required: true
2456
+ min: 1
2457
+ max: 20
2458
+ step: 1
2459
+ default: 7
2460
+ performance:
2461
+ order: 7
2462
+ title: en=Performance;ru=Производительность
2463
+ group: base
2464
+ type: string
2465
+ default: speed
2466
+ enum:
2467
+ - express|⚡ Express
2468
+ - speed|🚅 Speed
2469
+ - quality|💎 Quality
2470
+ seed:
2471
+ order: 9
2472
+ title: en=Seed;ru=Начальный шум
2473
+ group: base
2474
+ type: integer
2475
+ placeholder: "-1"
2476
+ batchSize:
2477
+ order: 8
2478
+ title: en=Batch size;ru=Кол-во
2479
+ group: base
2480
+ type: integer
2481
+ min: 1
2482
  max: 4
2483
+ step: 1
2484
+ default: 1
2485
+ distanceTop:
2486
+ order: 1
2487
+ title: en=Distance top;ru=Расширить сверху
2488
+ group: distance
2489
+ type: integer
2490
+ min: 0
2491
+ max: 200
2492
+ step: 5
2493
+ default: 0
2494
+ distanceRight:
2495
+ order: 2
2496
+ title: en=Distance right;ru=Расширить справа
2497
+ group: distance
2498
+ type: integer
2499
+ min: 0
2500
+ max: 200
2501
+ step: 5
2502
+ default: 0
2503
+ distanceBottom:
2504
+ order: 3
2505
+ title: en=Distance bottom;ru=Расширить снизу
2506
+ group: distance
2507
+ type: integer
2508
+ min: 0
2509
+ max: 200
2510
+ step: 5
2511
+ default: 0
2512
+ distanceLeft:
2513
+ order: 4
2514
+ title: en=Distance left;ru=Расширить слева
2515
+ group: distance
2516
+ type: integer
2517
+ min: 0
2518
+ max: 200
2519
+ step: 5
2520
+ default: 0
2521
  outputs:
2522
+ image1:
2523
+ title: en=Image 1;ru=Изображение 1
2524
+ type: image
2525
+ images:
2526
+ title: en=Images;ru=Изображения
2527
+ type: image[]
2528
+ image2:
2529
+ title: en=Image 2;ru=Изображение 2
2530
+ type: image
2531
+ image3:
2532
+ title: en=Image 3;ru=Изображение 3
2533
+ type: image
2534
+ image4:
2535
+ title: en=Image 4;ru=Изображение 4
2536
  type: image
2537
  package: artworks
2538
+ script: |
2539
+ const CHECK_TASK_INTERVAL = 5000;
2540
+ const MAX_ATTEMPTS = 100;
 
 
 
2541
 
2542
  export async function run({ inputs, state }) {
2543
 
2544
  const { FatalError, TimeoutError, RepeatNode, NextNode } = DEFINITIONS;
2545
+ const { ArtWorks, fitSize, FatalError: ArtWorksError } = require('artworks');
2546
+ const sharp = require('sharp/lib/index.js');
2547
 
2548
  const PAAS_BASE_URL = env.variables.get('PAAS_BASE_URL');
2549
  if (!PAAS_BASE_URL) {
 
2567
  if (!state) {
2568
  const {
2569
  image,
2570
+ prompt,
2571
+ checkpoint,
2572
+ negativePrompt,
2573
+ denoisingStrength,
2574
+ cfgScale,
2575
+ performance,
2576
+ batchSize,
2577
+ seed,
2578
+ // distance
2579
+ distanceTop,
2580
+ distanceRight,
2581
+ distanceBottom,
2582
+ distanceLeft
2583
  } = inputs;
 
2584
  const payload = {
2585
+ type: "outpaint-on-image",
2586
  isFast: true,
2587
  payload: {
2588
  base64: false,
2589
  image,
2590
+ prompt,
2591
+ checkpoint,
2592
+ negativePrompt,
2593
+ denoisingStrength,
2594
+ cfgScale,
2595
+ performance,
2596
+ ...(batchSize > 1 ? { batchSize } : {}),
2597
+ seed,
2598
+ // distance
2599
+ distanceTop,
2600
+ distanceRight,
2601
+ distanceBottom,
2602
+ distanceLeft
2603
  },
2604
  };
2605
  try {
 
2661
  },
2662
  });
2663
  }
2664
+ let images = results.images.map((i) => i.url);
2665
+ const [image1, image2, image3, image4] = images;
2666
  return NextNode.from({
2667
  outputs: {
2668
+ images,
2669
+ image1,
2670
+ image2,
2671
+ image3,
2672
+ image4
2673
  }
2674
  });
2675
  } catch (e) {
 
2680
  }
2681
  }
2682
  }
2683
+ source: catalog
2684
+ title: en=Outpaint on image;ru=Расширить изображение
2685
+ version: 1
2686
+ ask_llm_artworks:
2687
+ _id: ask_llm_artworks
2688
  arrange:
2689
+ x: 210
2690
+ y: 800
2691
  category:
2692
+ _id: llm_agents
2693
+ id: llm_agents
2694
+ title: en=Language Agents;ru=Языковые агенты
2695
  environment:
2696
  OPEN_PAAS_USER:
2697
  title: PaaS user
 
2706
  type: string
2707
  scope: global
2708
  inputs:
2709
+ model:
2710
  order: 1
2711
+ title: en=Model;ru=Модель
 
 
 
 
 
2712
  type: string
2713
  required: true
2714
+ default: mistral:7b
2715
  enum:
2716
+ - mistral:7b
2717
+ answerFormat:
 
 
 
 
 
 
 
2718
  order: 3
2719
+ title: en=Answer format;ru=Формат ответа
2720
+ description: Don't forget add instructions for LLM
2721
  type: string
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2722
  required: true
2723
+ default: text
2724
+ enum:
2725
+ - text|Text
2726
+ - json|JSON
2727
+ question:
2728
+ order: 2
2729
+ title: en=Question;ru=Вопрос
2730
+ type: string
2731
+ required: true
2732
+ default: What time is it now? Only JSON ready to parse.
2733
  outputs:
2734
+ text:
2735
+ title: Text
2736
+ type: string
2737
+ json:
2738
+ title: JSON
2739
  type: json
 
2740
  package: artworks
2741
  script: |-
2742
  const CHECK_TASK_INTERVAL = 3000;
 
2746
 
2747
  const { FatalError, TimeoutError, RepeatNode, NextNode } = DEFINITIONS;
2748
  const { ArtWorks, FatalError: ArtWorksError } = require('artworks');
 
2749
 
2750
  const PAAS_BASE_URL = env.variables.get('PAAS_BASE_URL');
2751
  if (!PAAS_BASE_URL) {
 
2767
  });
2768
 
2769
  if (!state) {
2770
+ const { model, prompt } = inputs;
2771
 
2772
  const payload = {
2773
+ type: "ask-llm",
2774
  isFast: true,
2775
  payload: {
2776
  base64: false,
 
 
2777
  model,
2778
+ prompt
 
 
2779
  },
2780
  };
2781
  try {
 
2837
  },
2838
  });
2839
  }
2840
+ console.log(JSON.stringify(results));
2841
+ const { answerFormat } = inputs;
2842
+ const { message: { content: answer } } = results;
2843
+ switch (answerFormat) {
2844
+ case 'text':
2845
+ return NextNode.from({ outputs: { answer } });
2846
+ case 'json':
2847
+ try {
2848
+ const json = answer.replace(/^\`\`\`json\s*/ig, '').replace(/\`\`\`\s*$/ig, '');
2849
+ return NextNode.from({ outputs: { json: JSON.parse(json) } });
2850
+ } catch (e) {
2851
+ console.log(e);
2852
+ message(`Wrong JSON for question \`\`\`text\n${question}\n\`\`\`\nnanswer from LLM\n\`\`\`text${answer}\n\`\`\``, 'defect');
2853
+ throw new FatalError("Can't parse JSON asnwer from LLM");
2854
+ }
2855
+ default:
2856
+ throw new FatalError(`Wrong answer format ${answerFormat}`);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2857
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2858
  } catch (e) {
2859
  if (e instanceof ArtWorksError) {
2860
  throw new FatalError(e.message);
 
2864
  }
2865
  }
2866
  source: catalog
2867
+ title: en=Ask LLM agent;ru=Спросить LLM
2868
  version: 1
2869
+ ask_vlm_artworks:
2870
+ _id: ask_vlm_artworks
2871
  arrange:
2872
+ x: 590
2873
+ y: 800
2874
  category:
2875
+ _id: image_analysis
2876
  id: image_analysis
2877
  title: en=Image analysis;ru=Анализ изображений
2878
  environment:
 
2891
  inputs:
2892
  image:
2893
  order: 1
2894
+ title: en=Image;ru=Изображение
2895
  type: image
2896
  required: true
2897
+ prompt:
2898
  order: 2
2899
+ title: en=Prompt;ru=Подсказка
2900
+ type: string
2901
  required: true
2902
+ default: describe image
 
 
2903
  outputs:
2904
+ text:
2905
+ title: en=Text;ru=Описание
2906
+ type: string
2907
  package: artworks
2908
  script: |-
2909
+ const CHECK_TASK_INTERVAL = 3000;
2910
  const MAX_ATTEMPTS = 20;
2911
 
2912
  export async function run({ inputs, state }) {
 
2934
  });
2935
 
2936
  if (!state) {
2937
+ const {
2938
+ image,
2939
+ prompt,
2940
+ } = inputs;
2941
 
2942
  const payload = {
2943
+ type: "ask-vlm",
2944
  isFast: true,
2945
  payload: {
2946
  base64: false,
2947
  image,
2948
+ prompt,
2949
  },
2950
  };
2951
  try {
 
2962
  total: MAX_ATTEMPTS,
2963
  processed: 0
2964
  },
2965
+ delay: 5000
2966
  });
2967
  } catch (e) {
2968
  if (e instanceof ArtWorksError) {
 
3007
  },
3008
  });
3009
  }
3010
+ let { response: text } = results;
 
 
 
 
 
3011
  return NextNode.from({
3012
  outputs: {
3013
+ text
3014
  }
3015
  });
3016
  } catch (e) {
 
3022
  }
3023
  }
3024
  source: catalog
3025
+ title: en=Ask VLM;ru=Спросить VLM
3026
  version: 1
3027
+ detect_nsfw_artworks:
3028
+ _id: detect_nsfw_artworks
3029
  arrange:
3030
+ x: 210
3031
+ y: 980
3032
  category:
3033
+ _id: image_analysis
3034
  id: image_analysis
3035
  title: en=Image analysis;ru=Анализ изображений
3036
  environment:
 
3052
  title: en=Image;ru=Изображение
3053
  type: image
3054
  required: true
 
 
 
 
 
 
3055
  outputs:
3056
+ scores:
3057
+ title: en=Scores;ru=Оценки
 
 
 
3058
  type: json
 
3059
  package: artworks
3060
+ script: |-
3061
+ const CHECK_TASK_INTERVAL = 1000;
3062
+ const MAX_ATTEMPTS = 20;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3063
 
3064
  export async function run({ inputs, state }) {
3065
 
 
3086
  });
3087
 
3088
  if (!state) {
3089
+ const { image } = inputs;
3090
 
3091
  const payload = {
3092
+ type: "detect-nsfw",
3093
  isFast: true,
3094
  payload: {
3095
  base64: false,
3096
+ image
 
3097
  },
3098
  };
3099
  try {
 
3155
  },
3156
  });
3157
  }
 
 
 
 
 
 
 
 
3158
  return NextNode.from({
3159
  outputs: {
3160
+ scores: results
3161
+ }
 
 
 
 
 
 
 
 
 
 
 
 
3162
  });
3163
  } catch (e) {
3164
  if (e instanceof ArtWorksError) {
 
3169
  }
3170
  }
3171
  source: catalog
3172
+ title: en=Detect NSFW;ru=Определить NSFW
3173
  version: 1
3174
+ srore_aesthetics:
3175
+ _id: srore_aesthetics
3176
  arrange:
3177
+ x: 590
3178
+ y: 970
3179
  category:
3180
+ _id: image_analysis
3181
+ id: image_analysis
3182
+ title: en=Image analysis;ru=Анализ изображений
3183
  environment:
3184
  OPEN_PAAS_USER:
3185
  title: PaaS user
 
3199
  title: en=Image;ru=Изображение
3200
  type: image
3201
  required: true
 
 
 
 
 
 
 
 
 
3202
  outputs:
3203
+ scores:
3204
+ title: en=Scores;ru=Оценки
3205
+ type: json
3206
  package: artworks
3207
  script: |-
3208
+ const CHECK_TASK_INTERVAL = 1000;
3209
  const MAX_ATTEMPTS = 20;
3210
 
3211
  export async function run({ inputs, state }) {
 
3233
  });
3234
 
3235
  if (!state) {
3236
+ const { image } = inputs;
 
 
 
3237
 
3238
  const payload = {
3239
+ type: "score-aesthetics",
3240
  isFast: true,
3241
  payload: {
3242
  base64: false,
3243
+ image
 
3244
  },
3245
  };
3246
  try {
 
3257
  total: MAX_ATTEMPTS,
3258
  processed: 0
3259
  },
3260
+ delay: 2000
3261
  });
3262
  } catch (e) {
3263
  if (e instanceof ArtWorksError) {
 
3272
  attempt,
3273
  startedAt
3274
  } = state;
3275
+
3276
  if (attempt > MAX_ATTEMPTS) {
3277
  try {
3278
  await artworks.cancelTask(task);
 
3302
  },
3303
  });
3304
  }
 
3305
  return NextNode.from({
3306
  outputs: {
3307
+ scores: results
3308
  }
3309
  });
3310
  } catch (e) {
 
3316
  }
3317
  }
3318
  source: catalog
3319
+ title: en=Score aesthetics;ru=Оценить эстестику
3320
  version: 1