Building a flow: create promo cards of a product

Let's see an example. We're going to create a workflow that turns a single product photo into several stunning promo cards. By following this guide step-by-step, you can understand the logic and process of creating this workflow

Video version of this tutorial is available as well

  1. Go to the Flow and click the "Create" button.

  2. It's a good practice to store all your input data in a single node. Start by typing user input in the search bar of the left panel. Locate User-Defined Input Form and drag it to the workspace.

  3. This node has no pre-configured fields, so we should set them ourselves. Dive into the node’s settings and select Configure Fields.

  4. Add a field to store the input image. Let's name this field image and also change the type to String / URI to make it suitable for storing files.

  5. Let's add another field. I'm going to use ChatGPT to help me with the promo cards generation, so we will need the prompt for ChatGPT. Name this field prompt. This name is important in our case, so be careful.

    After saving these changes, return to your User-Defined Input Form node.

  6. Upload your image and add instructions for ChatGPT.

    Here is my image:

    And here is my prompt: Create a prompt for an image generation AI (like Midjourney) featuring a trendy shampoo bottle with a tropical texture background, natural shadows of the bottle. The prompt should only contain a description of the desired image and no commands like ‘create an image’. Describe the style as much as possible, write the prompt with the premise that the image should be cinematic and promotional. The output should not contain any additional words and headlines other than the prompt itself. The prompt should be no longer than 50 words. Feel free to modify the input data as much as you like or use your own.

  7. Hit the Execute button and then click Save and execute to run this node and generate outputs. We need them to move further.

  8. Now, we want our image background to be transparent, not white. Not only can we use the search bar in the left panel, we can also just right-click on the workspace as well. Choose Add processor.

    We want to remove the background, so start typing remove in the search bar. As you can see, you don't even have to finish the sentence: several models are already suggested. If you know what you need, just pick the model. In another case, you can rely on the description. Try and test different models.

    We’ll use Rembg in this workflow.

  9. After adding Rembg to your workspace, access its settings. Enable the Show on Node to make the input appear on the node.

    Next, connect the image output of your User-Defined Input Form node to the Image input of your Rembg node.

  10. Now, let's add some magic. Right-click on the workspace, choose Add processor again and search for the Ad-inpaint processor: type ad-inpaint in the search bar. This model uses your image and your text prompt as the input data and generates promo cards. Connect the output of your Rembg node with the Image Path input of your Ad-inpaint node.

  11. By default there will only be one promo card, but I want three. Let's go to the Ad-inpaint settings and increase the Image Num field to 3. You can increase it even further, but remember that this will also increase the execution time. Simply close this menu after you're all set.

  12. Next, we are going to use ChatGPT to generate a creative background description for Ad-inpaint. Add a ChatGPT Processor node to your workspace. You again can do it by using the search bar of the left pannel (right-clicking on the workspace and adding a processor works as well). Type chatgpt, and scroll a little if you don't see the desired processor right away.

    Connect the prompt output of your User-Defined Input Form node to the input of your ChatGPT Processor node.

  13. Handling ChatGPT Processor may be slightly more complex due to the syntax of the node. You'll need to refer to the prompt from your User-Defined Input node as a variable. First, open the settings of your User-Defined Input Form node and copy the Node ID.

    Second, go to the ChatGPT Processor settings, proceed to Messages. Click on the pencil and add a new message.

    Use the Node ID that you've just copied and write a line like this into the field: {{context["7yHF-user-input"]["prompt"]}} In place of 7yHF-user-input there should be the ID of your User-Defined Input Form. Don't forget to save the message!

    Or alternatively, you can use the Expression editor. We'll talk about this method later. By the way, you can also change the ChatGPT version, use the Model option in the settings.

    Connect the Success output of your ChatGPT node to the Prompt input of your Ad-inpaint node.

  14. Run your workflow by clicking Play in the top toolbar. Choose Save and execute when asked.

  15. After running the workflow, a generated prompt will appear in the ChatGPT node describing the image background to generate a beautiful card.

    Following the execution, the Ad-inpaint node will display four pictures: the original image and three photos of the product with generated backgrounds.

  16. The images already have good resolution, but, say, we want to upscale one of them anyway. Let's add a Gfpgan node — this model is widely used for improving image quality and upscaling. Again, you can get Gfpgan by using the left panel or by right-clicking on the workspace, type gfpgan in the search bar. Connect the output of your Ad-inpaint node and the Input of your Gfpgan node.

  17. As the Ad-inpaint doesn't display four images as separate outputs, you have to use variables again. In the Gfpgan's settings, change the Img input type to Expression.

    Next, click on the hash to open the Expression editor.

    Here you’ll see a list of nodes on the left. Find and open the Ad-inpaint node and click Success. This section represents all images that you can see on the Ad-Inpaint node: - 0 is the source image and is located in the top-left of the node; - 1 is the top-right generated image; - 2 is the left-bottom one; - 3 is the right-bottom image.

    Drag your desired image from the Success section into the editor field.

    Now, run Gfpgan by clicking Execute on the node. And there you have it! A high-resolution photo appears in the Gfpgan node.

  18. Extra actions are available by hovering over images: preview the image or download it

You can integrate this workflow to your product via API. Contact us to get access, documentation and support

Last updated