{
  "nodes": [
    {
      "id": "6359f725-1ede-4b05-bc19-05a7e85c0865",
      "name": "When clicking \"Test workflow\"",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        680,
        292
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "9e1e61c7-f5fd-4e8a-99a6-ccc5a24f5528",
      "name": "Fetch Source Image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1000,
        292
      ],
      "parameters": {
        "url": "={{ $json.source_image }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "9b1b94cf-3a7d-4c43-ab6c-8df9824b5667",
      "name": "Split Out Results Only",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1428,
        323
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "result"
      },
      "typeVersion": 1
    },
    {
      "id": "fcbaf6c3-2aee-4ea1-9c5e-2833dd7a9f50",
      "name": "Filter Score >= 0.9",
      "type": "n8n-nodes-base.filter",
      "position": [
        1608,
        323
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "367d83ef-8ecf-41fe-858c-9bfd78b0ae9f",
              "operator": {
                "type": "number",
                "operation": "gte"
              },
              "leftValue": "={{ $json.score }}",
              "rightValue": 0.9
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "954ce7b0-ef82-4203-8706-17cfa5e5e3ff",
      "name": "Crop Object From Image",
      "type": "n8n-nodes-base.editImage",
      "position": [
        2080,
        432
      ],
      "parameters": {
        "width": "={{ $json.box.xmax - $json.box.xmin }}",
        "height": "={{ $json.box.ymax - $json.box.ymin }}",
        "options": {
          "format": "jpeg",
          "fileName": "={{ $binary.data.fileName.split('.')[0].urlEncode()+'-'+$json.label.urlEncode() + '-' + $itemIndex }}.jpg"
        },
        "operation": "crop",
        "positionX": "={{ $json.box.xmin }}",
        "positionY": "={{ $json.box.ymin }}"
      },
      "typeVersion": 1
    },
    {
      "id": "40027456-4bf9-4eea-8d71-aa28e69b29e5",
      "name": "Set Variables",
      "type": "n8n-nodes-base.set",
      "position": [
        840,
        292
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9e95d951-8530-4a80-bd00-6bb55623a71f",
              "name": "CLOUDFLARE_ACCOUNT_ID",
              "type": "string",
              "value": ""
            },
            {
              "id": "66807a90-63a1-4d4e-886e-e8abf3019a34",
              "name": "model",
              "type": "string",
              "value": "@cf/facebook/detr-resnet-50"
            },
            {
              "id": "a13ccde6-e6e3-46f4-afa3-2134af7bc765",
              "name": "source_image",
              "type": "string",
              "value": "https://images.pexels.com/photos/2293367/pexels-photo-2293367.jpeg?auto=compress&cs=tinysrgb&w=600"
            },
            {
              "id": "0734fc55-b414-47f7-8b3e-5c880243f3ed",
              "name": "elasticsearch_index",
              "type": "string",
              "value": "n8n-image-search"
            }
          ]
        }
      },
      "typeVersion": 3.3
    },
    {
      "id": "c3d8c5e3-546e-472c-9e6e-091cf5cee3c3",
      "name": "Use Detr-Resnet-50 Object Classification",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1248,
        324
      ],
      "parameters": {
        "url": "=https://api.cloudflare.com/client/v4/accounts/{{ $('Set Variables').item.json.CLOUDFLARE_ACCOUNT_ID }}/ai/run/{{ $('Set Variables').item.json.model }}",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "binaryData",
        "authentication": "predefinedCredentialType",
        "inputDataFieldName": "data",
        "nodeCredentialType": "cloudflareApi"
      },
      "credentials": {
        "cloudflareApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "3c7aa2fc-9ca1-41ba-a10d-aa5930d45f18",
      "name": "Upload to Cloudinary",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2380,
        380
      ],
      "parameters": {
        "url": "https://api.cloudinary.com/v1_1/daglih2g8/image/upload",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendQuery": true,
        "contentType": "multipart-form-data",
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "file",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data"
            }
          ]
        },
        "genericAuthType": "httpQueryAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "upload_preset",
              "value": "n8n-workflows-preset"
            }
          ]
        }
      },
      "credentials": {
        "httpQueryAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "3c4e1f04-a0ba-4cce-b82a-aa3eadc4e7e1",
      "name": "Create Docs In Elasticsearch",
      "type": "n8n-nodes-base.elasticsearch",
      "position": [
        2580,
        380
      ],
      "parameters": {
        "indexId": "={{ $('Set Variables').item.json.elasticsearch_index }}",
        "options": {},
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "image_url",
              "fieldValue": "={{ $json.secure_url.replace('upload','upload/f_auto,q_auto') }}"
            },
            {
              "fieldId": "source_image_url",
              "fieldValue": "={{ $('Set Variables').item.json.source_image }}"
            },
            {
              "fieldId": "label",
              "fieldValue": "={{ $('Crop Object From Image').item.json.label }}"
            },
            {
              "fieldId": "metadata",
              "fieldValue": "={{ JSON.stringify(Object.assign($('Crop Object From Image').item.json, { filename: $json.original_filename })) }}"
            }
          ]
        },
        "operation": "create",
        "additionalFields": {}
      },
      "credentials": {
        "elasticsearchApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "292c9821-c123-44fa-9ba1-c37bf84079bc",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        620,
        120
      ],
      "parameters": {
        "color": 7,
        "width": 541.1455500767354,
        "height": 381.6388867600897,
        "content": "## 1. \uc18c\uc2a4 \uc774\ubbf8\uc9c0 \uac00\uc838\uc624\uae30\n\n[\uc6cc\ud06c\ud50c\ub85c\uc6b0 \ubcc0\uc218 \uc124\uc815\uc5d0 \ub300\ud574 \uc790\uc138\ud788 \uc54c\uc544\ubcf4\uae30](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.set)\n\n\uc774 \ub370\ubaa8\uc5d0\uc11c\ub294 \ucc98\ub9ac\ud560 \uc774\ubbf8\uc9c0\ub97c \uc218\ub3d9\uc73c\ub85c \uc815\uc758\ud558\uaca0\uc2b5\ub2c8\ub2e4. \uadf8\ub7ec\ub098 \ud504\ub85c\ub355\uc158 \ud658\uacbd\uc5d0\uc11c\ub294 \uc774 \uc774\ubbf8\uc9c0\uac00 \ub4dc\ub77c\uc774\ube0c, \uc6f9\ud6c5 \ub4f1 \ub2e4\uc591\ud55c \uc18c\uc2a4\uc5d0\uc11c \uc62c \uc218 \uc788\uc2b5\ub2c8\ub2e4."
      },
      "typeVersion": 1
    },
    {
      "id": "863271dc-fb9d-4211-972d-6b57336073b4",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1180,
        80
      ],
      "parameters": {
        "color": 7,
        "width": 579.7748008857744,
        "height": 437.4680103498263,
        "content": "## 2. Detr-Resnet-50 \uac1d\uccb4 \ubd84\ub958 \uc0ac\uc6a9\n\n[Cloudflare Workers AI\uc5d0 \ub300\ud574 \uc790\uc138\ud788 \uc54c\uc544\ubcf4\uae30](https://developers.cloudflare.com/workers-ai/)\n\n\ubaa8\ub4e0 AI \uc6cc\ud06c\ud50c\ub85c\uc6b0\uac00 LLM\uc744 \ud544\uc694\ub85c \ud558\ub294 \uac83\uc740 \uc544\ub2c8\ub2e4! \uc774 \uc608\uc81c\ucc98\ub7fc, \uc6b0\ub9ac\ub294 \ube44-LLM \ube44\uc804 \ubaa8\ub378\uc744 \uc0ac\uc6a9\ud558\uc5ec \uc18c\uc2a4 \uc774\ubbf8\uc9c0\ub97c \ubd84\uc11d\ud558\uace0 \uadf8 \uc548\uc5d0 \ud3ec\ud568\ub41c \uac1d\uccb4\ub97c \ubc18\ud658\ud569\ub2c8\ub2e4. \uc6b0\ub9ac\uac00 \uad6c\ucd95 \uc911\uc778 \uc774\ubbf8\uc9c0 \uac80\uc0c9 \uae30\ub2a5\uc740 \uc774\ubbf8\uc9c0\uc758 \uac1d\uccb4\ub97c \uae30\ubc18\uc73c\ub85c \ud558\uc5ec \uac1d\uccb4 \uc5f0\uad00\uc744 \ud1b5\ud574 \ud6e8\uc52c \ub354 \uc138\ubc00\ud55c \uac80\uc0c9\uc744 \uac00\ub2a5\ud558\uac8c \ud569\ub2c8\ub2e4.\n\n\uc6b0\ub9ac\ub294 Cloudflare Workers AI \uc11c\ube44\uc2a4\ub97c \uc0ac\uc6a9\ud560 \uac83\uc785\ub2c8\ub2e4. \uc774 \uc11c\ube44\uc2a4\ub294 \uc774 \ubaa8\ub378\uc744 API\ub97c \ud1b5\ud574 \ud3b8\ub9ac\ud558\uac8c \uc81c\uacf5\ud569\ub2c8\ub2e4."
      },
      "typeVersion": 1
    },
    {
      "id": "b73b45da-0436-4099-b538-c6b3b84822f2",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1800,
        260
      ],
      "parameters": {
        "color": 7,
        "width": 466.35460775498495,
        "height": 371.9272151757119,
        "content": "## 3. \uc18c\uc2a4 \uc774\ubbf8\uc9c0\uc5d0\uc11c \uac1d\uccb4 \uc790\ub974\uae30  \n[ n8n\uc5d0\uc11c \uc774\ubbf8\uc9c0 \ud3b8\uc9d1\uc5d0 \ub300\ud574 \ub354 \uc77d\uae30](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.editimage)  \n\n\uc6b0\ub9ac\uc758 \uac1d\uccb4\uac00 \ubc14\uc6b4\ub529 \ubc15\uc2a4\ub85c \uc2dd\ubcc4\ub41c \uc0c1\ud0dc\uc5d0\uc11c, \uc6b0\ub9ac\ub294 \uc18c\uc2a4 \uc774\ubbf8\uc9c0\uc5d0\uc11c \uadf8\uac83\ub4e4\uc744 \ubcc4\ub3c4\uc758 \uc774\ubbf8\uc9c0\ub85c \uc790\ub97c \uc218 \uc788\uc2b5\ub2c8\ub2e4."
      },
      "typeVersion": 1
    },
    {
      "id": "465bd842-8a35-49d8-a9ff-c30d164620db",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2300,
        180
      ],
      "parameters": {
        "color": 7,
        "width": 478.20345439832454,
        "height": 386.06196032653685,
        "content": "## 4. ElasticSearch\uc5d0 \uac1d\uccb4 \uc774\ubbf8\uc9c0 \uc0c9\uc778\n\n[ElasticSearch \uc0ac\uc6a9\uc5d0 \ub300\ud574 \ub354 \uc77d\uae30](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.elasticsearch)\n\n\uc0c8\ub85c \uc0dd\uc131\ub41c \uac1d\uccb4 \uc774\ubbf8\uc9c0\ub97c \uc678\ubd80\uc5d0 \uc800\uc7a5\ud558\uace0 \uc774\ub97c ElasticSearch\uc5d0 \uc0c9\uc778\ud654\ud558\uc5ec, \uc6b0\ub9ac\ub294 \uc774\uc81c \uac1d\uccb4 \uc5f0\uad00\uc5d0 \uc758\ud574 \ucffc\ub9ac\ud558\ub294 Image Search \uc11c\ube44\uc2a4\uc758 \uae30\ubc18\uc744 \ub9c8\ub828\ud588\uc2b5\ub2c8\ub2e4."
      },
      "typeVersion": 1
    },
    {
      "id": "6a04b4b5-7830-410d-9b5b-79acb0b1c78b",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1800,
        -220
      ],
      "parameters": {
        "color": 7,
        "width": 328.419768654291,
        "height": 462.65463700396174,
        "content": "\uadf8\ub9bc 1. \ubd84\ub958\uc758 \uacb0\uacfc  \n![\ubd84\ub958\uc758 \uc774\ubbf8\uc9c0](https://res.cloudinary.com/daglih2g8/image/upload/f_auto,q_auto,w_300/v1/n8n-workflows/ywtzjcmqrypihci1npgh)"
      },
      "typeVersion": 1
    },
    {
      "id": "8f607951-ba41-4362-8323-e8b4b96ad122",
      "name": "Fetch Source Image Again",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1880,
        432
      ],
      "parameters": {
        "url": "={{ $('Set Variables').item.json.source_image }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "6933f67d-276b-4908-8602-654aa352a68b",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        220,
        120
      ],
      "parameters": {
        "width": 359.6648027457353,
        "height": 352.41026669883723,
        "content": "## \uc9c1\uc811 \ud574\ubcf4\uc138\uc694!\n\n### \uc774 \uc6cc\ud06c\ud50c\ub85c\uc6b0\ub294 \ub2e4\uc74c\uacfc \uac19\uc740 \uc791\uc5c5\uc744 \uc218\ud589\ud569\ub2c8\ub2e4:\n* \uc774\ubbf8\uc9c0\ub97c \ub2e4\uc6b4\ub85c\ub4dc\ud569\ub2c8\ub2e4\n* \uc774\ubbf8\uc9c0\uc5d0\uc11c \uac1d\uccb4\ub97c \uc2dd\ubcc4\ud558\uae30 \uc704\ud574 \uac1d\uccb4 \ubd84\ub958 AI \ubaa8\ub378\uc744 \uc0ac\uc6a9\ud569\ub2c8\ub2e4.\n* \uc6d0\ubcf8 \uc774\ubbf8\uc9c0\uc5d0\uc11c \uac1d\uccb4\ub97c \uc798\ub77c\uc11c \uc0c8\ub85c\uc6b4 \uc774\ubbf8\uc9c0 \ud30c\uc77c\ub85c \ub9cc\ub4ed\ub2c8\ub2e4.\n* \uc774\ubbf8\uc9c0\uc758 \uac1d\uccb4\ub97c Elasticsearch \ub370\uc774\ud130\ubca0\uc774\uc2a4\uc5d0 \uc778\ub371\uc2f1\ud558\uc5ec \uc774\ubbf8\uc9c0 \uac80\uc0c9\uc744 \uac00\ub2a5\ud558\uac8c \ud569\ub2c8\ub2e4.\n\n### \ub3c4\uc6c0\uc774 \ud544\uc694\ud558\uc2e0\uac00\uc694?\n[Discord](https://discord.com/invite/XPKeKXeB7d)\uc5d0 \uac00\uc785\ud558\uac70\ub098 [Forum](https://community.n8n.io/)\uc5d0\uc11c \ubb38\uc758\ud558\uc138\uc694!\n\n\uc990\uac70\uc6b4 \ud574\ud0b9!"
      },
      "typeVersion": 1
    },
    {
      "id": "35615ed5-43e8-43f0-95fe-1f95a1177d69",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        280
      ],
      "parameters": {
        "width": 172.9365918827757,
        "height": 291.6881468483679,
        "content": "\ud83d\udea8**\ud544\uc218**  \n* \ubcc0\uc218\ub97c \uba3c\uc800 \uc5ec\uae30\uc5d0\uc11c \uc124\uc815\ud558\uc138\uc694!  \n### \ucd9c\ub825"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Set Variables": {
      "main": [
        [
          {
            "node": "Fetch Source Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Source Image": {
      "main": [
        [
          {
            "node": "Use Detr-Resnet-50 Object Classification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Score >= 0.9": {
      "main": [
        [
          {
            "node": "Fetch Source Image Again",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to Cloudinary": {
      "main": [
        [
          {
            "node": "Create Docs In Elasticsearch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Crop Object From Image": {
      "main": [
        [
          {
            "node": "Upload to Cloudinary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Results Only": {
      "main": [
        [
          {
            "node": "Filter Score >= 0.9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Source Image Again": {
      "main": [
        [
          {
            "node": "Crop Object From Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \"Test workflow\"": {
      "main": [
        [
          {
            "node": "Set Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Use Detr-Resnet-50 Object Classification": {
      "main": [
        [
          {
            "node": "Split Out Results Only",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}