Files
2024-05-29 09:55:19 +01:00

575 lines
12 KiB
JSON

{
"last_node_id": 23,
"last_link_id": 37,
"nodes": [
{
"id": 11,
"type": "CheckpointLoaderSimple",
"pos": [
1040,
630
],
"size": {
"0": 315,
"1": 98
},
"flags": {},
"order": 0,
"mode": 0,
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"links": [
11
],
"shape": 3,
"slot_index": 0
},
{
"name": "CLIP",
"type": "CLIP",
"links": [
16,
17
],
"shape": 3,
"slot_index": 1
},
{
"name": "VAE",
"type": "VAE",
"links": [
13,
19
],
"shape": 3,
"slot_index": 2
}
],
"properties": {
"Node name for S&R": "CheckpointLoaderSimple"
},
"widgets_values": [
"dreamshaper_8.safetensors"
]
},
{
"id": 14,
"type": "VAEDecode",
"pos": [
1810,
430
],
"size": {
"0": 210,
"1": 46
},
"flags": {},
"order": 9,
"mode": 0,
"inputs": [
{
"name": "samples",
"type": "LATENT",
"link": 18
},
{
"name": "vae",
"type": "VAE",
"link": 19
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
20
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "VAEDecode"
}
},
{
"id": 10,
"type": "VAEEncode",
"pos": [
1130,
530
],
"size": {
"0": 210,
"1": 46
},
"flags": {},
"order": 7,
"mode": 0,
"inputs": [
{
"name": "pixels",
"type": "IMAGE",
"link": 37
},
{
"name": "vae",
"type": "VAE",
"link": 13
}
],
"outputs": [
{
"name": "LATENT",
"type": "LATENT",
"links": [
12
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "VAEEncode"
}
},
{
"id": 15,
"type": "SaveImage",
"pos": [
546,
475
],
"size": {
"0": 360.7467041015625,
"1": 306.7426452636719
},
"flags": {},
"order": 10,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 20
}
],
"properties": {},
"widgets_values": [
"ComfyUI"
]
},
{
"id": 13,
"type": "CLIPTextEncode",
"pos": [
1374,
721
],
"size": {
"0": 407.85369873046875,
"1": 100.259521484375
},
"flags": {},
"order": 2,
"mode": 0,
"inputs": [
{
"name": "clip",
"type": "CLIP",
"link": 16
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"links": [
15
],
"shape": 3
}
],
"properties": {
"Node name for S&R": "CLIPTextEncode"
},
"widgets_values": [
""
],
"color": "#322",
"bgcolor": "#533"
},
{
"id": 8,
"type": "PreviewImage",
"pos": [
932,
138
],
"size": {
"0": 341.981689453125,
"1": 298.141357421875
},
"flags": {},
"order": 6,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 33
}
],
"title": "Filtered Image",
"properties": {
"Node name for S&R": "PreviewImage"
}
},
{
"id": 20,
"type": "ImageScaleToTotalPixels",
"pos": [
533,
60
],
"size": {
"0": 315,
"1": 82
},
"flags": {
"collapsed": false
},
"order": 4,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 30
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
34
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "ImageScaleToTotalPixels"
},
"widgets_values": [
"nearest-exact",
0.5
]
},
{
"id": 9,
"type": "KSampler",
"pos": [
1810,
530
],
"size": {
"0": 315,
"1": 262
},
"flags": {},
"order": 8,
"mode": 0,
"inputs": [
{
"name": "model",
"type": "MODEL",
"link": 11
},
{
"name": "positive",
"type": "CONDITIONING",
"link": 14,
"slot_index": 1
},
{
"name": "negative",
"type": "CONDITIONING",
"link": 15,
"slot_index": 2
},
{
"name": "latent_image",
"type": "LATENT",
"link": 12
}
],
"outputs": [
{
"name": "LATENT",
"type": "LATENT",
"links": [
18
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "KSampler"
},
"widgets_values": [
20657798808235,
"fixed",
20,
8,
"dpmpp_sde",
"karras",
0.6
]
},
{
"id": 5,
"type": "LoadImage",
"pos": [
190,
120
],
"size": {
"0": 333.08087158203125,
"1": 331.3231506347656
},
"flags": {},
"order": 1,
"mode": 0,
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
30
],
"shape": 3,
"slot_index": 0
},
{
"name": "MASK",
"type": "MASK",
"links": null,
"shape": 3
}
],
"properties": {
"Node name for S&R": "LoadImage"
},
"widgets_values": [
"IMG_20220430_192055.jpg",
"image"
]
},
{
"id": 12,
"type": "CLIPTextEncode",
"pos": [
540,
350
],
"size": {
"0": 368.5274353027344,
"1": 84.00090789794922
},
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{
"name": "clip",
"type": "CLIP",
"link": 17
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"links": [
14
],
"shape": 3
}
],
"properties": {
"Node name for S&R": "CLIPTextEncode"
},
"widgets_values": [
"lake scene with magic glowing fairies"
],
"color": "#232",
"bgcolor": "#353"
},
{
"id": 23,
"type": "AnyNode",
"pos": [
538,
185
],
"size": {
"0": 373.348388671875,
"1": 171.73358154296875
},
"flags": {},
"order": 5,
"mode": 0,
"inputs": [
{
"name": "any",
"type": "*",
"link": 34
}
],
"outputs": [
{
"name": "any",
"type": "*",
"links": [
33,
37
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "AnyNode"
},
"widgets_values": [
"I want you to output the image with an overlay of relatively medium sized white circles of different sizes. The circles should be organized using the 3D Boids algorithm where each circle's position is initialized randomly across the width and the height of the image and then run for 500 steps to get the final position, then the circles are overlayed on the image tensor in those positions, the size of the circle representing it's Z position.\n\nThe input should have four dimensions, (batch, width, height, color_channel) representing a batch of RGB images.\n\n\nHere is a working example that rotates hue by 180 and more importantly, outputs the right tensor shape:\n\n```python\ndef generated_function(input_data):\n # Convert input RGB tensor to a numpy array and normalize\n rgb_array = input_data.numpy()\n\n # Convert from RGB to HSV\n hsv_array = torch.empty_like(input_data)\n for i in range(rgb_array.shape[1]):\n for j in range(rgb_array.shape[2]):\n r, g, b = rgb_array[0,i,j] / 255.0\n max_c = max(r, g, b)\n min_c = min(r, g, b)\n delta = max_c - min_c\n \n # Calculate Hue\n if delta == 0:\n h = 0\n elif max_c == r:\n h = (60 * ((g - b) / delta) + 360) % 360\n elif max_c == g:\n h = (60 * ((b - r) / delta) + 120) % 360\n elif max_c == b:\n h = (60 * ((r - g) / delta) + 240) % 360\n \n # Calculate Saturation\n if max_c == 0:\n s = 0\n else:\n s = (delta / max_c)\n \n # Value is equal to max of R, G, B\n v = max_c\n \n # Shift Hue by 180 degrees\n h = (h + 180) % 360\n \n # Convert back to RGB\n c = v * s\n x = c * (1 - abs((h / 60) % 2 - 1))\n m = v - c\n \n if 0 <= h < 60:\n r1, g1, b1 = c, x, 0\n elif 60 <= h < 120:\n r1, g1, b1 = x, c, 0\n elif 120 <= h < 180:\n r1, g1, b1 = 0, c, x\n elif 180 <= h < 240:\n r1, g1, b1 = 0, x, c\n elif 240 <= h < 300:\n r1, g1, b1 = x, 0, c\n elif 300 <= h < 360:\n r1, g1, b1 = c, 0, x\n \n r, g, b = (r1 + m) * 255, (g1 + m) * 255, (b1 + m) * 255\n \n hsv_array[0,i,j,0] = r\n hsv_array[0,i,j,1] = g\n hsv_array[0,i,j,2] = b\n\n return hsv_array\n```"
],
"color": "#2a363b",
"bgcolor": "#3f5159"
}
],
"links": [
[
11,
11,
0,
9,
0,
"MODEL"
],
[
12,
10,
0,
9,
3,
"LATENT"
],
[
13,
11,
2,
10,
1,
"VAE"
],
[
14,
12,
0,
9,
1,
"CONDITIONING"
],
[
15,
13,
0,
9,
2,
"CONDITIONING"
],
[
16,
11,
1,
13,
0,
"CLIP"
],
[
17,
11,
1,
12,
0,
"CLIP"
],
[
18,
9,
0,
14,
0,
"LATENT"
],
[
19,
11,
2,
14,
1,
"VAE"
],
[
20,
14,
0,
15,
0,
"IMAGE"
],
[
30,
5,
0,
20,
0,
"IMAGE"
],
[
33,
23,
0,
8,
0,
"IMAGE"
],
[
34,
20,
0,
23,
0,
"*"
],
[
37,
23,
0,
10,
0,
"IMAGE"
]
],
"groups": [],
"config": {},
"extra": {},
"version": 0.4
}