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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "last_node_id": 131,
3
+ "last_link_id": 215,
4
+ "nodes": [
5
+ {
6
+ "id": 93,
7
+ "type": "UNETLoader",
8
+ "pos": [
9
+ -265.5894775390625,
10
+ 1531.7340087890625
11
+ ],
12
+ "size": [
13
+ 315,
14
+ 82
15
+ ],
16
+ "flags": {},
17
+ "order": 0,
18
+ "mode": 0,
19
+ "inputs": [],
20
+ "outputs": [
21
+ {
22
+ "name": "MODEL",
23
+ "type": "MODEL",
24
+ "links": [
25
+ 171
26
+ ],
27
+ "slot_index": 0
28
+ }
29
+ ],
30
+ "properties": {
31
+ "Node name for S&R": "UNETLoader"
32
+ },
33
+ "widgets_values": [
34
+ "flux1-dev.safetensors",
35
+ "default"
36
+ ]
37
+ },
38
+ {
39
+ "id": 44,
40
+ "type": "PulidFluxModelLoader",
41
+ "pos": [
42
+ -262.90264892578125,
43
+ 1662.658447265625
44
+ ],
45
+ "size": [
46
+ 315,
47
+ 58
48
+ ],
49
+ "flags": {},
50
+ "order": 1,
51
+ "mode": 0,
52
+ "inputs": [],
53
+ "outputs": [
54
+ {
55
+ "name": "PULIDFLUX",
56
+ "type": "PULIDFLUX",
57
+ "links": [
58
+ 77
59
+ ]
60
+ }
61
+ ],
62
+ "properties": {
63
+ "Node name for S&R": "PulidFluxModelLoader"
64
+ },
65
+ "widgets_values": [
66
+ "pulid_flux_v0.9.1.safetensors"
67
+ ]
68
+ },
69
+ {
70
+ "id": 45,
71
+ "type": "PulidFluxEvaClipLoader",
72
+ "pos": [
73
+ -294.8002624511719,
74
+ 1774.585693359375
75
+ ],
76
+ "size": [
77
+ 362.79498291015625,
78
+ 38.76161575317383
79
+ ],
80
+ "flags": {},
81
+ "order": 2,
82
+ "mode": 0,
83
+ "inputs": [],
84
+ "outputs": [
85
+ {
86
+ "name": "EVA_CLIP",
87
+ "type": "EVA_CLIP",
88
+ "links": [
89
+ 78
90
+ ]
91
+ }
92
+ ],
93
+ "properties": {
94
+ "Node name for S&R": "PulidFluxEvaClipLoader"
95
+ },
96
+ "widgets_values": []
97
+ },
98
+ {
99
+ "id": 46,
100
+ "type": "PulidFluxInsightFaceLoader",
101
+ "pos": [
102
+ -300.94317626953125,
103
+ 1863.1434326171875
104
+ ],
105
+ "size": [
106
+ 365.4000244140625,
107
+ 58
108
+ ],
109
+ "flags": {},
110
+ "order": 3,
111
+ "mode": 0,
112
+ "inputs": [],
113
+ "outputs": [
114
+ {
115
+ "name": "FACEANALYSIS",
116
+ "type": "FACEANALYSIS",
117
+ "links": [
118
+ 79
119
+ ]
120
+ }
121
+ ],
122
+ "properties": {
123
+ "Node name for S&R": "PulidFluxInsightFaceLoader"
124
+ },
125
+ "widgets_values": [
126
+ "CUDA"
127
+ ]
128
+ },
129
+ {
130
+ "id": 95,
131
+ "type": "VAELoader",
132
+ "pos": [
133
+ -265.02642822265625,
134
+ 1410.9061279296875
135
+ ],
136
+ "size": [
137
+ 315,
138
+ 58
139
+ ],
140
+ "flags": {},
141
+ "order": 4,
142
+ "mode": 0,
143
+ "inputs": [],
144
+ "outputs": [
145
+ {
146
+ "name": "VAE",
147
+ "type": "VAE",
148
+ "links": [
149
+ 160
150
+ ],
151
+ "slot_index": 0
152
+ }
153
+ ],
154
+ "properties": {
155
+ "Node name for S&R": "VAELoader"
156
+ },
157
+ "widgets_values": [
158
+ "FLUX1/ae.safetensors"
159
+ ]
160
+ },
161
+ {
162
+ "id": 94,
163
+ "type": "DualCLIPLoader",
164
+ "pos": [
165
+ -274.0904235839844,
166
+ 1235.6214599609375
167
+ ],
168
+ "size": [
169
+ 315,
170
+ 122.00001525878906
171
+ ],
172
+ "flags": {},
173
+ "order": 5,
174
+ "mode": 0,
175
+ "inputs": [],
176
+ "outputs": [
177
+ {
178
+ "name": "CLIP",
179
+ "type": "CLIP",
180
+ "links": [
181
+ 172,
182
+ 173
183
+ ],
184
+ "slot_index": 0
185
+ }
186
+ ],
187
+ "properties": {
188
+ "Node name for S&R": "DualCLIPLoader"
189
+ },
190
+ "widgets_values": [
191
+ "t5xxl_fp16.safetensors",
192
+ "clip_l.safetensors",
193
+ "flux",
194
+ "default"
195
+ ]
196
+ },
197
+ {
198
+ "id": 105,
199
+ "type": "Reroute",
200
+ "pos": [
201
+ 81.75617980957031,
202
+ 771.7276611328125
203
+ ],
204
+ "size": [
205
+ 75,
206
+ 26
207
+ ],
208
+ "flags": {},
209
+ "order": 20,
210
+ "mode": 0,
211
+ "inputs": [
212
+ {
213
+ "name": "",
214
+ "type": "*",
215
+ "link": 176
216
+ }
217
+ ],
218
+ "outputs": [
219
+ {
220
+ "name": "",
221
+ "type": "IMAGE",
222
+ "links": [
223
+ 175,
224
+ 199
225
+ ],
226
+ "slot_index": 0
227
+ }
228
+ ],
229
+ "properties": {
230
+ "showOutputText": false,
231
+ "horizontal": false
232
+ }
233
+ },
234
+ {
235
+ "id": 50,
236
+ "type": "KSamplerSelect",
237
+ "pos": [
238
+ 1312.514404296875,
239
+ 1212.9171142578125
240
+ ],
241
+ "size": [
242
+ 315,
243
+ 58
244
+ ],
245
+ "flags": {},
246
+ "order": 6,
247
+ "mode": 0,
248
+ "inputs": [],
249
+ "outputs": [
250
+ {
251
+ "name": "SAMPLER",
252
+ "type": "SAMPLER",
253
+ "links": [
254
+ 70
255
+ ]
256
+ }
257
+ ],
258
+ "properties": {
259
+ "Node name for S&R": "KSamplerSelect"
260
+ },
261
+ "widgets_values": [
262
+ "euler"
263
+ ]
264
+ },
265
+ {
266
+ "id": 97,
267
+ "type": "Reroute",
268
+ "pos": [
269
+ 621.4758911132812,
270
+ 1410.3482666015625
271
+ ],
272
+ "size": [
273
+ 75,
274
+ 26
275
+ ],
276
+ "flags": {},
277
+ "order": 15,
278
+ "mode": 0,
279
+ "inputs": [
280
+ {
281
+ "name": "",
282
+ "type": "*",
283
+ "link": 160
284
+ }
285
+ ],
286
+ "outputs": [
287
+ {
288
+ "name": "",
289
+ "type": "VAE",
290
+ "links": [
291
+ 157,
292
+ 158,
293
+ 191
294
+ ],
295
+ "slot_index": 0
296
+ }
297
+ ],
298
+ "properties": {
299
+ "showOutputText": false,
300
+ "horizontal": false
301
+ }
302
+ },
303
+ {
304
+ "id": 123,
305
+ "type": "Image Comparer (rgthree)",
306
+ "pos": [
307
+ 2166.79833984375,
308
+ 1418.202880859375
309
+ ],
310
+ "size": [
311
+ 476.6938171386719,
312
+ 546.7750854492188
313
+ ],
314
+ "flags": {},
315
+ "order": 29,
316
+ "mode": 0,
317
+ "inputs": [
318
+ {
319
+ "name": "image_a",
320
+ "type": "IMAGE",
321
+ "dir": 3,
322
+ "link": 206
323
+ },
324
+ {
325
+ "name": "image_b",
326
+ "type": "IMAGE",
327
+ "dir": 3,
328
+ "link": 208
329
+ }
330
+ ],
331
+ "outputs": [],
332
+ "properties": {
333
+ "comparer_mode": "Slide"
334
+ },
335
+ "widgets_values": [
336
+ [
337
+ {
338
+ "name": "A",
339
+ "selected": true,
340
+ "url": "/api/view?filename=rgthree.compare._temp_myvmc_00007_.png&type=temp&subfolder=&rand=0.6300855264758487"
341
+ },
342
+ {
343
+ "name": "B",
344
+ "selected": true,
345
+ "url": "/api/view?filename=rgthree.compare._temp_myvmc_00008_.png&type=temp&subfolder=&rand=0.46445824593894125"
346
+ }
347
+ ]
348
+ ]
349
+ },
350
+ {
351
+ "id": 118,
352
+ "type": "FaceAnalysisModels",
353
+ "pos": [
354
+ 1311.7503662109375,
355
+ 2008.2781982421875
356
+ ],
357
+ "size": [
358
+ 315,
359
+ 82
360
+ ],
361
+ "flags": {},
362
+ "order": 7,
363
+ "mode": 0,
364
+ "inputs": [],
365
+ "outputs": [
366
+ {
367
+ "name": "ANALYSIS_MODELS",
368
+ "type": "ANALYSIS_MODELS",
369
+ "links": [
370
+ 196
371
+ ],
372
+ "slot_index": 0
373
+ }
374
+ ],
375
+ "properties": {
376
+ "Node name for S&R": "FaceAnalysisModels"
377
+ },
378
+ "widgets_values": [
379
+ "insightface",
380
+ "CUDA"
381
+ ]
382
+ },
383
+ {
384
+ "id": 98,
385
+ "type": "Reroute",
386
+ "pos": [
387
+ 367.4774475097656,
388
+ 728.5109252929688
389
+ ],
390
+ "size": [
391
+ 75,
392
+ 26
393
+ ],
394
+ "flags": {},
395
+ "order": 19,
396
+ "mode": 0,
397
+ "inputs": [
398
+ {
399
+ "name": "",
400
+ "type": "*",
401
+ "link": 163
402
+ }
403
+ ],
404
+ "outputs": [
405
+ {
406
+ "name": "",
407
+ "type": "IMAGE",
408
+ "links": [
409
+ 161,
410
+ 162,
411
+ 206
412
+ ],
413
+ "slot_index": 0
414
+ }
415
+ ],
416
+ "properties": {
417
+ "showOutputText": false,
418
+ "horizontal": false
419
+ }
420
+ },
421
+ {
422
+ "id": 126,
423
+ "type": "Note",
424
+ "pos": [
425
+ -596.5314331054688,
426
+ 188.32418823242188
427
+ ],
428
+ "size": [
429
+ 230.86343383789062,
430
+ 88
431
+ ],
432
+ "flags": {},
433
+ "order": 8,
434
+ "mode": 0,
435
+ "inputs": [],
436
+ "outputs": [],
437
+ "properties": {},
438
+ "widgets_values": [
439
+ "The target image to face enhance"
440
+ ],
441
+ "color": "#432",
442
+ "bgcolor": "#653"
443
+ },
444
+ {
445
+ "id": 125,
446
+ "type": "Note",
447
+ "pos": [
448
+ -593.9556884765625,
449
+ 772.0499877929688
450
+ ],
451
+ "size": [
452
+ 230.86343383789062,
453
+ 88
454
+ ],
455
+ "flags": {},
456
+ "order": 9,
457
+ "mode": 0,
458
+ "inputs": [],
459
+ "outputs": [],
460
+ "properties": {},
461
+ "widgets_values": [
462
+ "The reference face image"
463
+ ],
464
+ "color": "#432",
465
+ "bgcolor": "#653"
466
+ },
467
+ {
468
+ "id": 127,
469
+ "type": "Note",
470
+ "pos": [
471
+ -538.2857666015625,
472
+ 1239.5035400390625
473
+ ],
474
+ "size": [
475
+ 230.86343383789062,
476
+ 88
477
+ ],
478
+ "flags": {},
479
+ "order": 10,
480
+ "mode": 0,
481
+ "inputs": [],
482
+ "outputs": [],
483
+ "properties": {},
484
+ "widgets_values": [
485
+ "Positive/negative prompts are optional"
486
+ ],
487
+ "color": "#432",
488
+ "bgcolor": "#653"
489
+ },
490
+ {
491
+ "id": 124,
492
+ "type": "Reroute",
493
+ "pos": [
494
+ 2035.27978515625,
495
+ 1079.953125
496
+ ],
497
+ "size": [
498
+ 75,
499
+ 26
500
+ ],
501
+ "flags": {},
502
+ "order": 28,
503
+ "mode": 0,
504
+ "inputs": [
505
+ {
506
+ "name": "",
507
+ "type": "*",
508
+ "link": 207
509
+ }
510
+ ],
511
+ "outputs": [
512
+ {
513
+ "name": "",
514
+ "type": "IMAGE",
515
+ "links": [
516
+ 208,
517
+ 210,
518
+ 211
519
+ ],
520
+ "slot_index": 0
521
+ }
522
+ ],
523
+ "properties": {
524
+ "showOutputText": false,
525
+ "horizontal": false
526
+ }
527
+ },
528
+ {
529
+ "id": 122,
530
+ "type": "BasicGuider",
531
+ "pos": [
532
+ 1313.324462890625,
533
+ 981.9154052734375
534
+ ],
535
+ "size": [
536
+ 241.79998779296875,
537
+ 46
538
+ ],
539
+ "flags": {},
540
+ "order": 24,
541
+ "mode": 0,
542
+ "inputs": [
543
+ {
544
+ "name": "model",
545
+ "type": "MODEL",
546
+ "link": 204
547
+ },
548
+ {
549
+ "name": "conditioning",
550
+ "type": "CONDITIONING",
551
+ "link": 203
552
+ }
553
+ ],
554
+ "outputs": [
555
+ {
556
+ "name": "GUIDER",
557
+ "type": "GUIDER",
558
+ "links": [
559
+ 202
560
+ ],
561
+ "slot_index": 0
562
+ }
563
+ ],
564
+ "properties": {
565
+ "Node name for S&R": "BasicGuider"
566
+ },
567
+ "widgets_values": []
568
+ },
569
+ {
570
+ "id": 41,
571
+ "type": "SetUnionControlNetType",
572
+ "pos": [
573
+ 200.7367706298828,
574
+ 1973.8323974609375
575
+ ],
576
+ "size": [
577
+ 315,
578
+ 58
579
+ ],
580
+ "flags": {},
581
+ "order": 18,
582
+ "mode": 0,
583
+ "inputs": [
584
+ {
585
+ "name": "control_net",
586
+ "type": "CONTROL_NET",
587
+ "link": 94
588
+ }
589
+ ],
590
+ "outputs": [
591
+ {
592
+ "name": "CONTROL_NET",
593
+ "type": "CONTROL_NET",
594
+ "links": [
595
+ 89
596
+ ]
597
+ }
598
+ ],
599
+ "properties": {
600
+ "Node name for S&R": "SetUnionControlNetType"
601
+ },
602
+ "widgets_values": [
603
+ "tile"
604
+ ]
605
+ },
606
+ {
607
+ "id": 49,
608
+ "type": "ControlNetLoader",
609
+ "pos": [
610
+ -299.92938232421875,
611
+ 1973.3970947265625
612
+ ],
613
+ "size": [
614
+ 370.503173828125,
615
+ 62.10068130493164
616
+ ],
617
+ "flags": {},
618
+ "order": 11,
619
+ "mode": 0,
620
+ "inputs": [],
621
+ "outputs": [
622
+ {
623
+ "name": "CONTROL_NET",
624
+ "type": "CONTROL_NET",
625
+ "links": [
626
+ 94
627
+ ]
628
+ }
629
+ ],
630
+ "properties": {
631
+ "Node name for S&R": "ControlNetLoader"
632
+ },
633
+ "widgets_values": [
634
+ "Flux_Dev_ControlNet_Union_Pro_ShakkerLabs.safetensors"
635
+ ]
636
+ },
637
+ {
638
+ "id": 42,
639
+ "type": "CLIPTextEncode",
640
+ "pos": [
641
+ 224.627685546875,
642
+ 1002.7890014648438
643
+ ],
644
+ "size": [
645
+ 400,
646
+ 200
647
+ ],
648
+ "flags": {},
649
+ "order": 16,
650
+ "mode": 0,
651
+ "inputs": [
652
+ {
653
+ "name": "clip",
654
+ "type": "CLIP",
655
+ "link": 172
656
+ }
657
+ ],
658
+ "outputs": [
659
+ {
660
+ "name": "CONDITIONING",
661
+ "type": "CONDITIONING",
662
+ "links": [
663
+ 87
664
+ ]
665
+ }
666
+ ],
667
+ "properties": {
668
+ "Node name for S&R": "CLIPTextEncode"
669
+ },
670
+ "widgets_values": [
671
+ ""
672
+ ]
673
+ },
674
+ {
675
+ "id": 37,
676
+ "type": "ControlNetApplyAdvanced",
677
+ "pos": [
678
+ 837.775634765625,
679
+ 1001.7030029296875
680
+ ],
681
+ "size": [
682
+ 315,
683
+ 186
684
+ ],
685
+ "flags": {},
686
+ "order": 22,
687
+ "mode": 0,
688
+ "inputs": [
689
+ {
690
+ "name": "positive",
691
+ "type": "CONDITIONING",
692
+ "link": 87
693
+ },
694
+ {
695
+ "name": "negative",
696
+ "type": "CONDITIONING",
697
+ "link": 88
698
+ },
699
+ {
700
+ "name": "control_net",
701
+ "type": "CONTROL_NET",
702
+ "link": 89
703
+ },
704
+ {
705
+ "name": "image",
706
+ "type": "IMAGE",
707
+ "link": 162
708
+ },
709
+ {
710
+ "name": "vae",
711
+ "type": "VAE",
712
+ "shape": 7,
713
+ "link": 157
714
+ }
715
+ ],
716
+ "outputs": [
717
+ {
718
+ "name": "positive",
719
+ "type": "CONDITIONING",
720
+ "links": [
721
+ 203
722
+ ],
723
+ "slot_index": 0
724
+ },
725
+ {
726
+ "name": "negative",
727
+ "type": "CONDITIONING",
728
+ "links": []
729
+ }
730
+ ],
731
+ "properties": {
732
+ "Node name for S&R": "ControlNetApplyAdvanced"
733
+ },
734
+ "widgets_values": [
735
+ 1,
736
+ 0.1,
737
+ 0.8
738
+ ]
739
+ },
740
+ {
741
+ "id": 35,
742
+ "type": "VAEEncode",
743
+ "pos": [
744
+ 1320.22705078125,
745
+ 888.8261108398438
746
+ ],
747
+ "size": [
748
+ 210,
749
+ 46
750
+ ],
751
+ "flags": {},
752
+ "order": 21,
753
+ "mode": 0,
754
+ "inputs": [
755
+ {
756
+ "name": "pixels",
757
+ "type": "IMAGE",
758
+ "link": 161
759
+ },
760
+ {
761
+ "name": "vae",
762
+ "type": "VAE",
763
+ "link": 158
764
+ }
765
+ ],
766
+ "outputs": [
767
+ {
768
+ "name": "LATENT",
769
+ "type": "LATENT",
770
+ "links": [
771
+ 72
772
+ ]
773
+ }
774
+ ],
775
+ "properties": {
776
+ "Node name for S&R": "VAEEncode"
777
+ },
778
+ "widgets_values": []
779
+ },
780
+ {
781
+ "id": 23,
782
+ "type": "CLIPTextEncode",
783
+ "pos": [
784
+ 228.5153350830078,
785
+ 1266.098388671875
786
+ ],
787
+ "size": [
788
+ 400,
789
+ 200
790
+ ],
791
+ "flags": {
792
+ "collapsed": true
793
+ },
794
+ "order": 17,
795
+ "mode": 0,
796
+ "inputs": [
797
+ {
798
+ "name": "clip",
799
+ "type": "CLIP",
800
+ "link": 173
801
+ }
802
+ ],
803
+ "outputs": [
804
+ {
805
+ "name": "CONDITIONING",
806
+ "type": "CONDITIONING",
807
+ "links": [
808
+ 88
809
+ ]
810
+ }
811
+ ],
812
+ "properties": {
813
+ "Node name for S&R": "CLIPTextEncode"
814
+ },
815
+ "widgets_values": [
816
+ ""
817
+ ]
818
+ },
819
+ {
820
+ "id": 128,
821
+ "type": "SaveImage",
822
+ "pos": [
823
+ 2184.40869140625,
824
+ 882.2232666015625
825
+ ],
826
+ "size": [
827
+ 440.4703063964844,
828
+ 463.7738952636719
829
+ ],
830
+ "flags": {},
831
+ "order": 31,
832
+ "mode": 0,
833
+ "inputs": [
834
+ {
835
+ "name": "images",
836
+ "type": "IMAGE",
837
+ "link": 211
838
+ }
839
+ ],
840
+ "outputs": [],
841
+ "properties": {
842
+ "Node name for S&R": "SaveImage"
843
+ },
844
+ "widgets_values": [
845
+ "FaceEnhanced"
846
+ ]
847
+ },
848
+ {
849
+ "id": 117,
850
+ "type": "FaceEmbedDistance",
851
+ "pos": [
852
+ 1792.0877685546875,
853
+ 2008.6629638671875
854
+ ],
855
+ "size": [
856
+ 315,
857
+ 170
858
+ ],
859
+ "flags": {},
860
+ "order": 30,
861
+ "mode": 0,
862
+ "inputs": [
863
+ {
864
+ "name": "analysis_models",
865
+ "type": "ANALYSIS_MODELS",
866
+ "link": 196
867
+ },
868
+ {
869
+ "name": "reference",
870
+ "type": "IMAGE",
871
+ "link": 199
872
+ },
873
+ {
874
+ "name": "image",
875
+ "type": "IMAGE",
876
+ "link": 210
877
+ }
878
+ ],
879
+ "outputs": [
880
+ {
881
+ "name": "IMAGE",
882
+ "type": "IMAGE",
883
+ "links": [
884
+ 212
885
+ ],
886
+ "slot_index": 0
887
+ },
888
+ {
889
+ "name": "distance",
890
+ "type": "FLOAT",
891
+ "links": [
892
+ 201
893
+ ],
894
+ "slot_index": 1
895
+ }
896
+ ],
897
+ "properties": {
898
+ "Node name for S&R": "FaceEmbedDistance"
899
+ },
900
+ "widgets_values": [
901
+ "cosine",
902
+ 100,
903
+ 0,
904
+ true
905
+ ]
906
+ },
907
+ {
908
+ "id": 121,
909
+ "type": "Display Any (rgthree)",
910
+ "pos": [
911
+ 2242.676513671875,
912
+ 2028.4595947265625
913
+ ],
914
+ "size": [
915
+ 264.5999755859375,
916
+ 88
917
+ ],
918
+ "flags": {},
919
+ "order": 33,
920
+ "mode": 0,
921
+ "inputs": [
922
+ {
923
+ "name": "source",
924
+ "type": "*",
925
+ "dir": 3,
926
+ "link": 201
927
+ }
928
+ ],
929
+ "outputs": [],
930
+ "properties": {
931
+ "Node name for S&R": "Display Any (rgthree)"
932
+ },
933
+ "widgets_values": [
934
+ ""
935
+ ]
936
+ },
937
+ {
938
+ "id": 129,
939
+ "type": "SaveImage",
940
+ "pos": [
941
+ 2185.483154296875,
942
+ 2173.050537109375
943
+ ],
944
+ "size": [
945
+ 440.4703063964844,
946
+ 463.7738952636719
947
+ ],
948
+ "flags": {},
949
+ "order": 32,
950
+ "mode": 0,
951
+ "inputs": [
952
+ {
953
+ "name": "images",
954
+ "type": "IMAGE",
955
+ "link": 212
956
+ }
957
+ ],
958
+ "outputs": [],
959
+ "properties": {
960
+ "Node name for S&R": "SaveImage"
961
+ },
962
+ "widgets_values": [
963
+ "FaceEmbedDist"
964
+ ]
965
+ },
966
+ {
967
+ "id": 40,
968
+ "type": "LoadImage",
969
+ "pos": [
970
+ -351.87322998046875,
971
+ 188.0283966064453
972
+ ],
973
+ "size": [
974
+ 433.580322265625,
975
+ 523.640869140625
976
+ ],
977
+ "flags": {},
978
+ "order": 12,
979
+ "mode": 0,
980
+ "inputs": [],
981
+ "outputs": [
982
+ {
983
+ "name": "IMAGE",
984
+ "type": "IMAGE",
985
+ "links": [
986
+ 163
987
+ ],
988
+ "slot_index": 0
989
+ },
990
+ {
991
+ "name": "MASK",
992
+ "type": "MASK",
993
+ "links": null
994
+ }
995
+ ],
996
+ "properties": {
997
+ "Node name for S&R": "LoadImage"
998
+ },
999
+ "widgets_values": [
1000
+ "chatgpt_elon.png",
1001
+ "image"
1002
+ ]
1003
+ },
1004
+ {
1005
+ "id": 24,
1006
+ "type": "LoadImage",
1007
+ "pos": [
1008
+ -352.1936340332031,
1009
+ 770.800537109375
1010
+ ],
1011
+ "size": [
1012
+ 404.0055236816406,
1013
+ 404.2244567871094
1014
+ ],
1015
+ "flags": {},
1016
+ "order": 13,
1017
+ "mode": 0,
1018
+ "inputs": [],
1019
+ "outputs": [
1020
+ {
1021
+ "name": "IMAGE",
1022
+ "type": "IMAGE",
1023
+ "links": [
1024
+ 176
1025
+ ],
1026
+ "slot_index": 0
1027
+ },
1028
+ {
1029
+ "name": "MASK",
1030
+ "type": "MASK",
1031
+ "links": null
1032
+ }
1033
+ ],
1034
+ "properties": {
1035
+ "Node name for S&R": "LoadImage"
1036
+ },
1037
+ "widgets_values": [
1038
+ "elon (1).jpg",
1039
+ "image"
1040
+ ]
1041
+ },
1042
+ {
1043
+ "id": 31,
1044
+ "type": "ApplyPulidFlux",
1045
+ "pos": [
1046
+ 221.46853637695312,
1047
+ 1532.384033203125
1048
+ ],
1049
+ "size": [
1050
+ 315,
1051
+ 346
1052
+ ],
1053
+ "flags": {},
1054
+ "order": 23,
1055
+ "mode": 0,
1056
+ "inputs": [
1057
+ {
1058
+ "name": "model",
1059
+ "type": "MODEL",
1060
+ "link": 171
1061
+ },
1062
+ {
1063
+ "name": "pulid_flux",
1064
+ "type": "PULIDFLUX",
1065
+ "link": 77
1066
+ },
1067
+ {
1068
+ "name": "eva_clip",
1069
+ "type": "EVA_CLIP",
1070
+ "link": 78
1071
+ },
1072
+ {
1073
+ "name": "face_analysis",
1074
+ "type": "FACEANALYSIS",
1075
+ "link": 79
1076
+ },
1077
+ {
1078
+ "name": "image",
1079
+ "type": "IMAGE",
1080
+ "link": 175
1081
+ },
1082
+ {
1083
+ "name": "attn_mask",
1084
+ "type": "MASK",
1085
+ "shape": 7,
1086
+ "link": null
1087
+ },
1088
+ {
1089
+ "name": "prior_image",
1090
+ "type": "IMAGE",
1091
+ "shape": 7,
1092
+ "link": null
1093
+ }
1094
+ ],
1095
+ "outputs": [
1096
+ {
1097
+ "name": "MODEL",
1098
+ "type": "MODEL",
1099
+ "links": [
1100
+ 204,
1101
+ 215
1102
+ ],
1103
+ "slot_index": 0
1104
+ }
1105
+ ],
1106
+ "properties": {
1107
+ "Node name for S&R": "ApplyPulidFlux"
1108
+ },
1109
+ "widgets_values": [
1110
+ 0.75,
1111
+ 0.1,
1112
+ 1,
1113
+ "mean",
1114
+ 1,
1115
+ 0,
1116
+ 1000,
1117
+ true
1118
+ ]
1119
+ },
1120
+ {
1121
+ "id": 131,
1122
+ "type": "BasicScheduler",
1123
+ "pos": [
1124
+ 1313.8270263671875,
1125
+ 1318.2603759765625
1126
+ ],
1127
+ "size": [
1128
+ 315,
1129
+ 106
1130
+ ],
1131
+ "flags": {},
1132
+ "order": 25,
1133
+ "mode": 0,
1134
+ "inputs": [
1135
+ {
1136
+ "name": "model",
1137
+ "type": "MODEL",
1138
+ "link": 215
1139
+ }
1140
+ ],
1141
+ "outputs": [
1142
+ {
1143
+ "name": "SIGMAS",
1144
+ "type": "SIGMAS",
1145
+ "links": [
1146
+ 214
1147
+ ],
1148
+ "slot_index": 0
1149
+ }
1150
+ ],
1151
+ "properties": {
1152
+ "Node name for S&R": "BasicScheduler"
1153
+ },
1154
+ "widgets_values": [
1155
+ "beta",
1156
+ 28,
1157
+ 0.75
1158
+ ]
1159
+ },
1160
+ {
1161
+ "id": 39,
1162
+ "type": "RandomNoise",
1163
+ "pos": [
1164
+ 1311.832763671875,
1165
+ 1088.896728515625
1166
+ ],
1167
+ "size": [
1168
+ 315,
1169
+ 82
1170
+ ],
1171
+ "flags": {},
1172
+ "order": 14,
1173
+ "mode": 0,
1174
+ "inputs": [],
1175
+ "outputs": [
1176
+ {
1177
+ "name": "NOISE",
1178
+ "type": "NOISE",
1179
+ "links": [
1180
+ 68
1181
+ ]
1182
+ }
1183
+ ],
1184
+ "properties": {
1185
+ "Node name for S&R": "RandomNoise"
1186
+ },
1187
+ "widgets_values": [
1188
+ 1,
1189
+ "fixed"
1190
+ ]
1191
+ },
1192
+ {
1193
+ "id": 1,
1194
+ "type": "SamplerCustomAdvanced",
1195
+ "pos": [
1196
+ 1767.5123291015625,
1197
+ 874.9805908203125
1198
+ ],
1199
+ "size": [
1200
+ 355.20001220703125,
1201
+ 106
1202
+ ],
1203
+ "flags": {},
1204
+ "order": 26,
1205
+ "mode": 0,
1206
+ "inputs": [
1207
+ {
1208
+ "name": "noise",
1209
+ "type": "NOISE",
1210
+ "link": 68
1211
+ },
1212
+ {
1213
+ "name": "guider",
1214
+ "type": "GUIDER",
1215
+ "link": 202
1216
+ },
1217
+ {
1218
+ "name": "sampler",
1219
+ "type": "SAMPLER",
1220
+ "link": 70
1221
+ },
1222
+ {
1223
+ "name": "sigmas",
1224
+ "type": "SIGMAS",
1225
+ "link": 214
1226
+ },
1227
+ {
1228
+ "name": "latent_image",
1229
+ "type": "LATENT",
1230
+ "link": 72
1231
+ }
1232
+ ],
1233
+ "outputs": [
1234
+ {
1235
+ "name": "output",
1236
+ "type": "LATENT",
1237
+ "links": [
1238
+ 190
1239
+ ],
1240
+ "slot_index": 0
1241
+ },
1242
+ {
1243
+ "name": "denoised_output",
1244
+ "type": "LATENT",
1245
+ "links": null
1246
+ }
1247
+ ],
1248
+ "properties": {
1249
+ "Node name for S&R": "SamplerCustomAdvanced"
1250
+ },
1251
+ "widgets_values": []
1252
+ },
1253
+ {
1254
+ "id": 114,
1255
+ "type": "VAEDecode",
1256
+ "pos": [
1257
+ 1771.2335205078125,
1258
+ 1040.572021484375
1259
+ ],
1260
+ "size": [
1261
+ 210,
1262
+ 46
1263
+ ],
1264
+ "flags": {},
1265
+ "order": 27,
1266
+ "mode": 0,
1267
+ "inputs": [
1268
+ {
1269
+ "name": "samples",
1270
+ "type": "LATENT",
1271
+ "link": 190
1272
+ },
1273
+ {
1274
+ "name": "vae",
1275
+ "type": "VAE",
1276
+ "link": 191
1277
+ }
1278
+ ],
1279
+ "outputs": [
1280
+ {
1281
+ "name": "IMAGE",
1282
+ "type": "IMAGE",
1283
+ "links": [
1284
+ 207
1285
+ ],
1286
+ "slot_index": 0
1287
+ }
1288
+ ],
1289
+ "properties": {
1290
+ "Node name for S&R": "VAEDecode"
1291
+ },
1292
+ "widgets_values": []
1293
+ }
1294
+ ],
1295
+ "links": [
1296
+ [
1297
+ 68,
1298
+ 39,
1299
+ 0,
1300
+ 1,
1301
+ 0,
1302
+ "NOISE"
1303
+ ],
1304
+ [
1305
+ 70,
1306
+ 50,
1307
+ 0,
1308
+ 1,
1309
+ 2,
1310
+ "SAMPLER"
1311
+ ],
1312
+ [
1313
+ 72,
1314
+ 35,
1315
+ 0,
1316
+ 1,
1317
+ 4,
1318
+ "LATENT"
1319
+ ],
1320
+ [
1321
+ 77,
1322
+ 44,
1323
+ 0,
1324
+ 31,
1325
+ 1,
1326
+ "PULIDFLUX"
1327
+ ],
1328
+ [
1329
+ 78,
1330
+ 45,
1331
+ 0,
1332
+ 31,
1333
+ 2,
1334
+ "EVA_CLIP"
1335
+ ],
1336
+ [
1337
+ 79,
1338
+ 46,
1339
+ 0,
1340
+ 31,
1341
+ 3,
1342
+ "FACEANALYSIS"
1343
+ ],
1344
+ [
1345
+ 87,
1346
+ 42,
1347
+ 0,
1348
+ 37,
1349
+ 0,
1350
+ "CONDITIONING"
1351
+ ],
1352
+ [
1353
+ 88,
1354
+ 23,
1355
+ 0,
1356
+ 37,
1357
+ 1,
1358
+ "CONDITIONING"
1359
+ ],
1360
+ [
1361
+ 89,
1362
+ 41,
1363
+ 0,
1364
+ 37,
1365
+ 2,
1366
+ "CONTROL_NET"
1367
+ ],
1368
+ [
1369
+ 94,
1370
+ 49,
1371
+ 0,
1372
+ 41,
1373
+ 0,
1374
+ "CONTROL_NET"
1375
+ ],
1376
+ [
1377
+ 157,
1378
+ 97,
1379
+ 0,
1380
+ 37,
1381
+ 4,
1382
+ "VAE"
1383
+ ],
1384
+ [
1385
+ 158,
1386
+ 97,
1387
+ 0,
1388
+ 35,
1389
+ 1,
1390
+ "VAE"
1391
+ ],
1392
+ [
1393
+ 160,
1394
+ 95,
1395
+ 0,
1396
+ 97,
1397
+ 0,
1398
+ "*"
1399
+ ],
1400
+ [
1401
+ 161,
1402
+ 98,
1403
+ 0,
1404
+ 35,
1405
+ 0,
1406
+ "IMAGE"
1407
+ ],
1408
+ [
1409
+ 162,
1410
+ 98,
1411
+ 0,
1412
+ 37,
1413
+ 3,
1414
+ "IMAGE"
1415
+ ],
1416
+ [
1417
+ 163,
1418
+ 40,
1419
+ 0,
1420
+ 98,
1421
+ 0,
1422
+ "*"
1423
+ ],
1424
+ [
1425
+ 171,
1426
+ 93,
1427
+ 0,
1428
+ 31,
1429
+ 0,
1430
+ "MODEL"
1431
+ ],
1432
+ [
1433
+ 172,
1434
+ 94,
1435
+ 0,
1436
+ 42,
1437
+ 0,
1438
+ "CLIP"
1439
+ ],
1440
+ [
1441
+ 173,
1442
+ 94,
1443
+ 0,
1444
+ 23,
1445
+ 0,
1446
+ "CLIP"
1447
+ ],
1448
+ [
1449
+ 175,
1450
+ 105,
1451
+ 0,
1452
+ 31,
1453
+ 4,
1454
+ "IMAGE"
1455
+ ],
1456
+ [
1457
+ 176,
1458
+ 24,
1459
+ 0,
1460
+ 105,
1461
+ 0,
1462
+ "*"
1463
+ ],
1464
+ [
1465
+ 190,
1466
+ 1,
1467
+ 0,
1468
+ 114,
1469
+ 0,
1470
+ "LATENT"
1471
+ ],
1472
+ [
1473
+ 191,
1474
+ 97,
1475
+ 0,
1476
+ 114,
1477
+ 1,
1478
+ "VAE"
1479
+ ],
1480
+ [
1481
+ 196,
1482
+ 118,
1483
+ 0,
1484
+ 117,
1485
+ 0,
1486
+ "ANALYSIS_MODELS"
1487
+ ],
1488
+ [
1489
+ 199,
1490
+ 105,
1491
+ 0,
1492
+ 117,
1493
+ 1,
1494
+ "IMAGE"
1495
+ ],
1496
+ [
1497
+ 201,
1498
+ 117,
1499
+ 1,
1500
+ 121,
1501
+ 0,
1502
+ "*"
1503
+ ],
1504
+ [
1505
+ 202,
1506
+ 122,
1507
+ 0,
1508
+ 1,
1509
+ 1,
1510
+ "GUIDER"
1511
+ ],
1512
+ [
1513
+ 203,
1514
+ 37,
1515
+ 0,
1516
+ 122,
1517
+ 1,
1518
+ "CONDITIONING"
1519
+ ],
1520
+ [
1521
+ 204,
1522
+ 31,
1523
+ 0,
1524
+ 122,
1525
+ 0,
1526
+ "MODEL"
1527
+ ],
1528
+ [
1529
+ 206,
1530
+ 98,
1531
+ 0,
1532
+ 123,
1533
+ 0,
1534
+ "IMAGE"
1535
+ ],
1536
+ [
1537
+ 207,
1538
+ 114,
1539
+ 0,
1540
+ 124,
1541
+ 0,
1542
+ "*"
1543
+ ],
1544
+ [
1545
+ 208,
1546
+ 124,
1547
+ 0,
1548
+ 123,
1549
+ 1,
1550
+ "IMAGE"
1551
+ ],
1552
+ [
1553
+ 210,
1554
+ 124,
1555
+ 0,
1556
+ 117,
1557
+ 2,
1558
+ "IMAGE"
1559
+ ],
1560
+ [
1561
+ 211,
1562
+ 124,
1563
+ 0,
1564
+ 128,
1565
+ 0,
1566
+ "IMAGE"
1567
+ ],
1568
+ [
1569
+ 212,
1570
+ 117,
1571
+ 0,
1572
+ 129,
1573
+ 0,
1574
+ "IMAGE"
1575
+ ],
1576
+ [
1577
+ 214,
1578
+ 131,
1579
+ 0,
1580
+ 1,
1581
+ 3,
1582
+ "SIGMAS"
1583
+ ],
1584
+ [
1585
+ 215,
1586
+ 31,
1587
+ 0,
1588
+ 131,
1589
+ 0,
1590
+ "MODEL"
1591
+ ]
1592
+ ],
1593
+ "groups": [],
1594
+ "config": {},
1595
+ "extra": {
1596
+ "ds": {
1597
+ "scale": 0.4594972986357322,
1598
+ "offset": [
1599
+ 946.7575830609429,
1600
+ -566.8107983375609
1601
+ ]
1602
+ },
1603
+ "node_versions": {
1604
+ "comfy-core": "0.3.26",
1605
+ "ComfyUI-PuLID-Flux-Enhanced": "04e1b52320f1f14383afe18959349703623c5b88",
1606
+ "rgthree-comfy": "1.0.0",
1607
+ "comfyui_faceanalysis": "4919e4e931db0edb219ba5086b3c10b8af750631"
1608
+ },
1609
+ "ue_links": []
1610
+ },
1611
+ "version": 0.4
1612
+ }
FaceEnhancementProdApi.py ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import random
3
+ import sys
4
+ from typing import Sequence, Mapping, Any, Union
5
+ import torch
6
+
7
+
8
+ def get_value_at_index(obj: Union[Sequence, Mapping], index: int) -> Any:
9
+ """Returns the value at the given index of a sequence or mapping.
10
+
11
+ If the object is a sequence (like list or string), returns the value at the given index.
12
+ If the object is a mapping (like a dictionary), returns the value at the index-th key.
13
+
14
+ Some return a dictionary, in these cases, we look for the "results" key
15
+
16
+ Args:
17
+ obj (Union[Sequence, Mapping]): The object to retrieve the value from.
18
+ index (int): The index of the value to retrieve.
19
+
20
+ Returns:
21
+ Any: The value at the given index.
22
+
23
+ Raises:
24
+ IndexError: If the index is out of bounds for the object and the object is not a mapping.
25
+ """
26
+ try:
27
+ return obj[index]
28
+ except KeyError:
29
+ return obj["result"][index]
30
+
31
+
32
+ def find_path(name: str, path: str = None) -> str:
33
+ """
34
+ Recursively looks at parent folders starting from the given path until it finds the given name.
35
+ Returns the path as a Path object if found, or None otherwise.
36
+ """
37
+ # If no path is given, use the current working directory
38
+ if path is None:
39
+ path = os.getcwd()
40
+
41
+ # Check if the current directory contains the name
42
+ if name in os.listdir(path):
43
+ path_name = os.path.join(path, name)
44
+ print(f"{name} found: {path_name}")
45
+ return path_name
46
+
47
+ # Get the parent directory
48
+ parent_directory = os.path.dirname(path)
49
+
50
+ # If the parent directory is the same as the current directory, we've reached the root and stop the search
51
+ if parent_directory == path:
52
+ return None
53
+
54
+ # Recursively call the function with the parent directory
55
+ return find_path(name, parent_directory)
56
+
57
+
58
+ def add_comfyui_directory_to_sys_path() -> None:
59
+ """
60
+ Add 'ComfyUI' to the sys.path
61
+ """
62
+ comfyui_path = find_path("ComfyUI")
63
+ if comfyui_path is not None and os.path.isdir(comfyui_path):
64
+ sys.path.append(comfyui_path)
65
+ print(f"'{comfyui_path}' added to sys.path")
66
+
67
+
68
+ def add_extra_model_paths() -> None:
69
+ """
70
+ Parse the optional extra_model_paths.yaml file and add the parsed paths to the sys.path.
71
+ """
72
+ try:
73
+ from main import load_extra_path_config
74
+ except ImportError:
75
+ print(
76
+ "Could not import load_extra_path_config from main.py. Looking in utils.extra_config instead."
77
+ )
78
+ from utils.extra_config import load_extra_path_config
79
+
80
+ extra_model_paths = find_path("extra_model_paths.yaml")
81
+
82
+ if extra_model_paths is not None:
83
+ load_extra_path_config(extra_model_paths)
84
+ else:
85
+ print("Could not find the extra_model_paths config file.")
86
+
87
+
88
+ add_comfyui_directory_to_sys_path()
89
+ add_extra_model_paths()
90
+
91
+
92
+ def import_custom_nodes() -> None:
93
+ """Find all custom nodes in the custom_nodes folder and add those node objects to NODE_CLASS_MAPPINGS
94
+
95
+ This function sets up a new asyncio event loop, initializes the PromptServer,
96
+ creates a PromptQueue, and initializes the custom nodes.
97
+ """
98
+ import asyncio
99
+ import execution
100
+ from nodes import init_extra_nodes
101
+ import server
102
+
103
+ # Creating a new event loop and setting it as the default loop
104
+ loop = asyncio.new_event_loop()
105
+ asyncio.set_event_loop(loop)
106
+
107
+ # Creating an instance of PromptServer with the loop
108
+ server_instance = server.PromptServer(loop)
109
+ execution.PromptQueue(server_instance)
110
+
111
+ # Initializing custom nodes
112
+ init_extra_nodes()
113
+
114
+
115
+ from nodes import (
116
+ VAELoader,
117
+ ControlNetLoader,
118
+ ControlNetApplyAdvanced,
119
+ LoadImage,
120
+ NODE_CLASS_MAPPINGS,
121
+ UNETLoader,
122
+ CLIPTextEncode,
123
+ VAEEncode,
124
+ SaveImage,
125
+ VAEDecode,
126
+ DualCLIPLoader,
127
+ )
128
+
129
+
130
+ def main():
131
+ import_custom_nodes()
132
+ with torch.inference_mode():
133
+ dualcliploader = DualCLIPLoader()
134
+ dualcliploader_94 = dualcliploader.load_clip(
135
+ clip_name1="t5xxl_fp16.safetensors",
136
+ clip_name2="clip_l.safetensors",
137
+ type="flux",
138
+ device="default",
139
+ )
140
+
141
+ cliptextencode = CLIPTextEncode()
142
+ cliptextencode_23 = cliptextencode.encode(
143
+ text="", clip=get_value_at_index(dualcliploader_94, 0)
144
+ )
145
+
146
+ loadimage = LoadImage()
147
+ loadimage_24 = loadimage.load_image(image="elon (1).jpg")
148
+
149
+ loadimage_40 = loadimage.load_image(image="chatgpt_elon.png")
150
+
151
+ vaeloader = VAELoader()
152
+ vaeloader_95 = vaeloader.load_vae(vae_name="FLUX1/ae.safetensors")
153
+
154
+ vaeencode = VAEEncode()
155
+ vaeencode_35 = vaeencode.encode(
156
+ pixels=get_value_at_index(loadimage_40, 0),
157
+ vae=get_value_at_index(vaeloader_95, 0),
158
+ )
159
+
160
+ randomnoise = NODE_CLASS_MAPPINGS["RandomNoise"]()
161
+ randomnoise_39 = randomnoise.get_noise(noise_seed=random.randint(1, 2**64))
162
+
163
+ cliptextencode_42 = cliptextencode.encode(
164
+ text="", clip=get_value_at_index(dualcliploader_94, 0)
165
+ )
166
+
167
+ pulidfluxmodelloader = NODE_CLASS_MAPPINGS["PulidFluxModelLoader"]()
168
+ pulidfluxmodelloader_44 = pulidfluxmodelloader.load_model(
169
+ pulid_file="pulid_flux_v0.9.1.safetensors"
170
+ )
171
+
172
+ pulidfluxevacliploader = NODE_CLASS_MAPPINGS["PulidFluxEvaClipLoader"]()
173
+ pulidfluxevacliploader_45 = pulidfluxevacliploader.load_eva_clip()
174
+
175
+ pulidfluxinsightfaceloader = NODE_CLASS_MAPPINGS["PulidFluxInsightFaceLoader"]()
176
+ pulidfluxinsightfaceloader_46 = pulidfluxinsightfaceloader.load_insightface(
177
+ provider="CUDA"
178
+ )
179
+
180
+ controlnetloader = ControlNetLoader()
181
+ controlnetloader_49 = controlnetloader.load_controlnet(
182
+ control_net_name="Flux_Dev_ControlNet_Union_Pro_ShakkerLabs.safetensors"
183
+ )
184
+
185
+ ksamplerselect = NODE_CLASS_MAPPINGS["KSamplerSelect"]()
186
+ ksamplerselect_50 = ksamplerselect.get_sampler(sampler_name="euler")
187
+
188
+ unetloader = UNETLoader()
189
+ unetloader_93 = unetloader.load_unet(
190
+ unet_name="flux1-dev.safetensors", weight_dtype="default"
191
+ )
192
+
193
+ faceanalysismodels = NODE_CLASS_MAPPINGS["FaceAnalysisModels"]()
194
+ faceanalysismodels_118 = faceanalysismodels.load_models(
195
+ library="insightface", provider="CUDA"
196
+ )
197
+
198
+ applypulidflux = NODE_CLASS_MAPPINGS["ApplyPulidFlux"]()
199
+ setunioncontrolnettype = NODE_CLASS_MAPPINGS["SetUnionControlNetType"]()
200
+ controlnetapplyadvanced = ControlNetApplyAdvanced()
201
+ basicguider = NODE_CLASS_MAPPINGS["BasicGuider"]()
202
+ basicscheduler = NODE_CLASS_MAPPINGS["BasicScheduler"]()
203
+ samplercustomadvanced = NODE_CLASS_MAPPINGS["SamplerCustomAdvanced"]()
204
+ vaedecode = VAEDecode()
205
+ faceembeddistance = NODE_CLASS_MAPPINGS["FaceEmbedDistance"]()
206
+ display_any_rgthree = NODE_CLASS_MAPPINGS["Display Any (rgthree)"]()
207
+ image_comparer_rgthree = NODE_CLASS_MAPPINGS["Image Comparer (rgthree)"]()
208
+ saveimage = SaveImage()
209
+
210
+ for q in range(10):
211
+ applypulidflux_31 = applypulidflux.apply_pulid_flux(
212
+ weight=0.75,
213
+ start_at=0.1,
214
+ end_at=1,
215
+ fusion="mean",
216
+ fusion_weight_max=1,
217
+ fusion_weight_min=0,
218
+ train_step=1000,
219
+ use_gray=True,
220
+ model=get_value_at_index(unetloader_93, 0),
221
+ pulid_flux=get_value_at_index(pulidfluxmodelloader_44, 0),
222
+ eva_clip=get_value_at_index(pulidfluxevacliploader_45, 0),
223
+ face_analysis=get_value_at_index(pulidfluxinsightfaceloader_46, 0),
224
+ image=get_value_at_index(loadimage_24, 0),
225
+ unique_id=17601617597548643515,
226
+ )
227
+
228
+ setunioncontrolnettype_41 = setunioncontrolnettype.set_controlnet_type(
229
+ type="tile", control_net=get_value_at_index(controlnetloader_49, 0)
230
+ )
231
+
232
+ controlnetapplyadvanced_37 = controlnetapplyadvanced.apply_controlnet(
233
+ strength=1,
234
+ start_percent=0.1,
235
+ end_percent=0.8,
236
+ positive=get_value_at_index(cliptextencode_42, 0),
237
+ negative=get_value_at_index(cliptextencode_23, 0),
238
+ control_net=get_value_at_index(setunioncontrolnettype_41, 0),
239
+ image=get_value_at_index(loadimage_40, 0),
240
+ vae=get_value_at_index(vaeloader_95, 0),
241
+ )
242
+
243
+ basicguider_122 = basicguider.get_guider(
244
+ model=get_value_at_index(applypulidflux_31, 0),
245
+ conditioning=get_value_at_index(controlnetapplyadvanced_37, 0),
246
+ )
247
+
248
+ basicscheduler_131 = basicscheduler.get_sigmas(
249
+ scheduler="beta",
250
+ steps=28,
251
+ denoise=0.75,
252
+ model=get_value_at_index(applypulidflux_31, 0),
253
+ )
254
+
255
+ samplercustomadvanced_1 = samplercustomadvanced.sample(
256
+ noise=get_value_at_index(randomnoise_39, 0),
257
+ guider=get_value_at_index(basicguider_122, 0),
258
+ sampler=get_value_at_index(ksamplerselect_50, 0),
259
+ sigmas=get_value_at_index(basicscheduler_131, 0),
260
+ latent_image=get_value_at_index(vaeencode_35, 0),
261
+ )
262
+
263
+ vaedecode_114 = vaedecode.decode(
264
+ samples=get_value_at_index(samplercustomadvanced_1, 0),
265
+ vae=get_value_at_index(vaeloader_95, 0),
266
+ )
267
+
268
+ faceembeddistance_117 = faceembeddistance.analize(
269
+ similarity_metric="cosine",
270
+ filter_thresh=100,
271
+ filter_best=0,
272
+ generate_image_overlay=True,
273
+ analysis_models=get_value_at_index(faceanalysismodels_118, 0),
274
+ reference=get_value_at_index(loadimage_24, 0),
275
+ image=get_value_at_index(vaedecode_114, 0),
276
+ )
277
+
278
+ display_any_rgthree_121 = display_any_rgthree.main(
279
+ source=get_value_at_index(faceembeddistance_117, 1)
280
+ )
281
+
282
+ image_comparer_rgthree_123 = image_comparer_rgthree.compare_images(
283
+ image_a=get_value_at_index(loadimage_40, 0),
284
+ image_b=get_value_at_index(vaedecode_114, 0),
285
+ )
286
+
287
+ saveimage_128 = saveimage.save_images(
288
+ filename_prefix="FaceEnhanced",
289
+ images=get_value_at_index(vaedecode_114, 0),
290
+ )
291
+
292
+ saveimage_129 = saveimage.save_images(
293
+ filename_prefix="FaceEmbedDist",
294
+ images=get_value_at_index(faceembeddistance_117, 0),
295
+ )
296
+
297
+
298
+ if __name__ == "__main__":
299
+ main()