Revolutionize eCommerce with AI-Powered Virtual Try-On Agents

Revolutionize eCommerce with AI-Powered Virtual Try-On Agents: Discover how to leverage AI image generation and multi-agent systems to create customizable, photo-realistic product visuals for social media and online selling. Learn to integrate advanced techniques like IP Adapters and ControlNet for enhanced control over generated images.

July 14, 2024


Discover the power of AI-generated fashion content! This blog post explores how to leverage cutting-edge image generation models to create visually stunning social media posts for your e-commerce business. Learn how to seamlessly integrate custom clothing and models into your marketing strategy, driving customer engagement and confidence.

How AI-Generated Influencers Work

AI-generated influencers have been a big topic last year. Their companies literally build for launching AI Instagram models that look just like people, and will post their "lives" on Instagram. And those people look absolutely real, except they don't really exist in the real world - or I should say, they do exist, but more likely to be a male prompt engineer controlling all those different AI models instead of a real girl. And some of them are clearly fake and AI-generated, but still got 20K, 80K, or even more than 100K followers on Twitter, and probably it's generating some sort of revenue.

So even though I don't really get why people want to follow someone who they know is not real, they clearly demand it. I've been thinking about what kind of actual business value or use case that could exist for those AI models. And recently, my brother-in-law, Rich, who is running a small business in China to sell clothes online, asked me: "Can you get AI to create 20 or 30 different social posts of people wearing my clothes every day?"

This sounds bizarre to me at the beginning, like why do you need so many new posts every day? Then he told me the reason he needs so many different new posts every day is because for people who are buying things online in China, they would go to social media platforms like Red Book to find other people who also bought similar products and see their reviews and pictures. And if someone searches for the clothes that he is selling, then the customer will gain more confidence that this product is probably a good fit.

I don't really know whether his brilliant strategy is actually going to work out, and I personally don't really like the idea of AI-generated social media posts. But I do think AI-powered models for fashion and clothes are going to be very valuable. It can help people visualize how the clothes are going to look much better than a static image, and those e-commerce sites can just generate a huge amount of product images for different types of customers.

That's why for the past few days, I've been looking into image generation and building an agent that can actually mix, match different faces, clothes, and even posture and environment together into popular social media posts for those fashion brands. And I'm going to show you how to do it, because image generation is actually a lot of fun.

The Value of AI-Powered Fashion Try-on

AI-powered fashion try-on can provide significant value for e-commerce businesses and customers alike:

  1. Enhanced Customer Experience: By allowing customers to virtually "try on" clothes, they can better visualize how the garments will look on them. This improves the shopping experience and reduces the likelihood of returns due to poor fit or appearance.

  2. Increased Conversion Rates: When customers can see themselves wearing the clothes, they are more likely to make a purchase. This can lead to higher conversion rates and improved sales.

  3. Reduced Returns: With the ability to virtually try on clothes, customers are less likely to order items that don't fit or suit them. This can lead to a reduction in costly returns, which can significantly impact a business's bottom line.

  4. Efficient Product Presentation: Generating a large number of product images with different models, poses, and environments can be time-consuming and expensive. AI-powered fashion try-on can automate this process, allowing businesses to create a diverse product catalog more efficiently.

  5. Personalized Recommendations: The data collected from customers' virtual try-on experiences can be used to provide personalized product recommendations, further enhancing the shopping experience and increasing the likelihood of additional sales.

  6. Expanded Product Offerings: With AI-powered fashion try-on, businesses can offer a wider range of products, as they no longer need to rely solely on physical product samples or professional photoshoots.

Overall, the integration of AI-powered fashion try-on can provide a significant competitive advantage for e-commerce businesses, improving the customer experience, increasing sales, and reducing operational costs.

Building an AI Image Generation Pipeline


In this section, we will explore how to build a flexible and powerful AI image generation pipeline using tools like Stable Diffusion, Confiy AI, and Anthropic's Autogon. We will cover the following key aspects:

  1. Understanding Diffusion Models: We'll dive into the underlying principles of diffusion models and how they can be used to generate high-quality images from text prompts.

  2. Leveraging Confiy AI: We'll use Confiy AI, an open-source project, to create a custom image generation workflow that allows us to integrate various models and techniques, such as IP Adapters and Control Net.

  3. Deploying to Replicate: We'll learn how to deploy our Confiy AI workflow to Replicate, a hosted platform, to make it accessible as a scalable API service.

  4. Constructing a Multi-Agent System: Finally, we'll build a multi-agent system using Anthropic's Autogon framework, where different agents collaborate to generate, review, and enhance the final image.

By the end of this section, you'll have a comprehensive understanding of how to build a flexible and powerful AI image generation pipeline that can be used for various applications, such as social media content creation, e-commerce product visualization, and more.

Understanding Diffusion Models

Diffusion models are a type of generative AI model that can be used to generate high-quality images from text prompts. The key idea behind diffusion models is to start with a random noise image and gradually "denoise" it, step by step, until the desired image is obtained.

The process works as follows:

  1. Noise Injection: The model starts with a random noise image and gradually adds more noise to it, creating a sequence of increasingly noisy images.
  2. Denoising: The model then learns to reverse this process, taking the noisy images and gradually removing the noise, step by step, until the original image is recovered.

This iterative denoising process allows the model to learn the underlying patterns and relationships between the text prompts and the corresponding images, enabling it to generate new images that match the given prompts.

Leveraging Confiy AI

Confiy AI is an open-source project that provides a flexible and powerful framework for building custom image generation pipelines. It allows you to integrate various models and techniques, such as Stable Diffusion, IP Adapters, and Control Net, to create a tailored solution for your specific needs.

In this section, we'll walk through the process of setting up a Confiy AI workflow that can generate images with custom faces, clothing, and environments. We'll cover the following steps:

  1. Installing and Configuring Confiy AI: We'll set up the necessary dependencies and download the required models.
  2. Integrating IP Adapters: We'll learn how to use IP Adapters to seamlessly incorporate custom face and clothing elements into the generated images.
  3. Utilizing Control Net: We'll explore how to use Control Net to add additional control over the generated images, such as specific poses or environments.
  4. Optimizing the Workflow: We'll fine-tune the workflow to achieve the desired image quality and consistency.

Deploying to Replicate

Once we've built our custom image generation pipeline in Confiy AI, we'll learn how to deploy it to Replicate, a hosted platform that allows us to run the workflow as a scalable API service.

This will involve the following steps:

  1. Exporting the Confiy AI Workflow: We'll export our workflow in a format that can be easily integrated with Replicate.
  2. Modifying the Workflow for Replicate: We'll make any necessary adjustments to the workflow to ensure compatibility with Replicate's requirements.
  3. Deploying to Replicate: We'll upload our workflow to Replicate and test the API endpoint.

By deploying our image generation pipeline to Replicate, we can make it accessible to other users or integrate it into various applications, allowing for scalable and efficient image generation.

Constructing a Multi-Agent System

Finally, we'll build a multi-agent system using Anthropic's Autogon framework to create a more sophisticated and iterative image generation process. This system will involve the following agents:

  1. Image Generator: This agent will be responsible for generating the initial image based on the provided text prompt and reference images.
  2. Image Reviewer: This agent will evaluate the generated image and provide feedback to the Image Generator, suggesting improvements or iterations.
  3. Image Enhancer: This agent will apply specialized techniques, such as hand restoration and image upscaling, to refine the final image.

By leveraging the collaborative nature of the multi-agent system, we can create a more robust and versatile image generation pipeline that can handle a wide range of use cases and requirements.

Throughout this section, we'll provide code examples and step-by-step instructions to guide you through the process of building this comprehensive AI image generation pipeline. By the end, you'll have a powerful tool at your disposal that can be customized and deployed to meet your specific needs.

Deploying the AI Model on Replicate

To deploy the AI model on Replicate, we need to make some slight changes to the workflow. Replicate supports specific models and custom nodes, so we need to find alternatives that are compatible with their platform.

First, we need to remove some custom nodes that Replicate doesn't support. In this case, we'll remove the prepare image for inside face node. We can then use the original image instead.

After making these changes, we can click the "Save API format" button to save the workflow as a JSON file. This JSON file can then be uploaded to Replicate to create a new workflow.

Next, we need to update the model used in the workflow. Replicate supports a different set of models, so we'll need to find an alternative that works for our use case. In this example, we'll use the Jugernaut model.

We also need to change the load image node to use an image URL instead of a local file. This makes it easier to use the workflow on Replicate.

Once these changes are made, we can copy the JSON file and go to the Replicate UI. Here, we can create a new workflow and paste the JSON code. Replicate will then generate the image based on the workflow we've defined.

The total time to generate the image on Replicate is around 2 minutes, which is much faster than running it on a local machine with a 3080 GPU. This is because Replicate uses powerful GPUs to scale the image generation process.

One thing to note is that some parts of the generated image may not perfectly match the original clothing image. To address this, we can build a multi-agent system that iterates on the image generation process until the clothing is a 100% match.

In the next section, we'll explore how to create this multi-agent system using the Autogon framework, which makes it easier to set up complex workflows with multiple agents collaborating to achieve the desired result.

Creating a Multi-Agent System with AutoGPT


In this section, we will explore how to create a multi-agent system using AutoGPT to generate and refine AI-powered images for fashion and e-commerce applications. The system will consist of several agents working together to:

  1. Generate an initial image based on a text prompt and a reference image.
  2. Review the generated image and provide feedback to improve it.
  3. Fine-tune the image by fixing any issues and upscaling it to a higher quality.

This approach allows for a more iterative and controlled image generation process, leveraging the strengths of different AI models and techniques.

Implementing the Multi-Agent System

Setting up the Environment

  1. Create a new folder for your project and open it in Visual Studio Code.
  2. Create three files:,, and a .env file to store your API credentials.

Defining the Tools

In, we'll create the functions that the agents will use to perform their tasks.

1import os 2from dotenv import load_dotenv 3import replicate 4 5load_dotenv() 6 7def generate_image(original_image_url, prompt): 8 """Generate an image using the Replicate API and a ConvAI workflow.""" 9 workflow_json = { 10 # ConvAI workflow JSON 11 } 12 workflow_json["inputs"]["prompt"] = prompt 13 workflow_json["inputs"]["image"] = original_image_url 14 15 model = 16 "replicate/convai-workflow:latest", 17 input=workflow_json 18 ) 19 return { 20 "original_image_url": original_image_url, 21 "prompt": prompt, 22 "generated_image": model 23 } 24 25def review_image(original_image_url, generated_image_url, prompt): 26 """Review the generated image using the GPT-4 Vision API.""" 27 openai.api_key = os.getenv("OPENAI_API_KEY") 28 response = openai.Image.create_edit( 29 image=original_image_url, 30 mask=generated_image_url, 31 prompt=f"The first image is the original clothing item. The second image is the AI-generated image of a person wearing the clothing. Please compare the two images and provide feedback on how well the generated image matches the original, on a scale of 0-100%. Also, provide any specific feedback on how the generated image could be improved to better match the original.", 32 n=1, 33 size="1024x1024" 34 ) 35 return response["data"][0]["text"] 36 37def fix_hands(image_url): 38 """Fix any hand distortion in the generated image using a Replicate model.""" 39 model = 40 "replicate/hand-restoration:latest", 41 input={"image": image_url} 42 ) 43 return model 44 45def upscale_image(image_url): 46 """Upscale the generated image using a Replicate model.""" 47 model = 48 "replicate/ultimate-upscaler:latest", 49 input={"image": image_url} 50 ) 51 return model

Setting up the Agents

In, we'll define the agents and their interactions.

1import os 2from dotenv import load_dotenv 3from autogpt.agent import Agent 4from autogpt.prompts.prompt import Prompt 5from tools import generate_image, review_image, fix_hands, upscale_image 6 7load_dotenv() 8 9# Define the agents 10image_generator = Agent( 11 "image_generator", 12 "You are an AI image prompt engineer. You will be given an image of clothing and a text prompt. Your task is to continuously iterate on the image generation based on feedback from the image reviewer until the reviewer is satisfied with the result.", 13 model_name="gpt-4" 14) 15 16image_reviewer = Agent( 17 "image_reviewer", 18 "You are an AI image reviewer. You will be given an original clothing image and an AI-generated image of a person wearing that clothing. Your task is to compare the two images and provide feedback on how well the generated image matches the original, on a scale of 0-100%. Also, provide any specific feedback on how the generated image could be improved to better match the original.", 19 model_name="gpt-4" 20) 21 22image_finetuner = Agent( 23 "image_finetuner", 24 "You are an AI image finetuner. You will be given an AI-generated image of a person wearing clothing, along with the original clothing image and the latest prompt used to generate the image. Your task is to fix any issues with the generated image, such as hand distortion, and then upscale the image to a higher quality.", 25 model_name="gpt-4" 26) 27 28# Register the tools 29image_generator.register_tool(generate_image) 30image_reviewer.register_tool(review_image) 31image_finetuner.register_tool(fix_hands) 32image_finetuner.register_tool(upscale_image) 33 34# Create the group chat 35group_chat = Agent.create_group_chat([image_generator, image_reviewer], max_rounds=7) 36group_chat_manager = Agent.create_group_chat_manager(group_chat, model_name="gpt-4") 37 38# Start the workflow 39user_proxy = Agent("user_proxy", "You are a user proxy agent. You will initiate the image generation and refinement workflow.", model_name="gpt-4", human_input_mode="never") 40user_proxy.do_initial_chat( 41 group_chat_manager, 42 "The original clothing item is [ORIGINAL_IMAGE_URL]. Please generate a hyper-realistic photo based on this original image and the prompt 'a woman wearing a blue jacket in a cafe in Paris' that passes a 95% match from the image reviewer." 43)

In this setup, we have three agents:

  1. Image Generator: Responsible for generating the initial image based on the provided prompt and reference image.
  2. Image Reviewer: Compares the generated image to the original reference image and provides feedback on how well they match.
  3. Image Finetuner: Fixes any issues with the generated image (e.g., hand distortion) and upscales it to a higher quality.

The group_chat and group_chat_manager handle the coordination and flow of information between the agents.

The user_proxy agent is responsible for initiating the workflow and passing the initial prompt and reference image to the group chat.

Running the Workflow

To run the workflow, execute the script. The agents will collaborate to generate, review, and refine the image until the final result is satisfactory.

The output will show the chat history between the agents, including the feedback and iterations on the generated image.


By creating a multi-agent system with AutoGPT, we've built a flexible and extensible workflow for generating and refining AI-powered images. This approach allows for better control, customization, and quality assurance compared to a single-step image generation process.

You can further enhance this system by adding more specialized agents, integrating additional AI models, and exploring different use cases beyond fashion and e-commerce.


The AI-generated influencer trend has been a significant topic in recent years. Companies are literally building AI Instagram models that look just like real people, and these AI-generated models can amass thousands or even hundreds of thousands of followers on social media platforms.

While the idea of following someone who doesn't actually exist in the real world may seem bizarre, there are potential business use cases for these AI models. For example, e-commerce businesses may want to generate a large number of social media posts featuring their products being worn by different models to build social proof and confidence with potential customers.

To create these AI-generated social media posts, one can leverage image generation models like Stable Diffusion and DALL-E, combined with techniques like latent diffusion and IP adapters. These allow for the generation of highly customized images, including the ability to insert specific faces, clothing, and environments.

By building a workflow in a tool like Conf.AI and deploying it on a platform like Replicate, you can create a scalable, production-ready image generation pipeline. This can be further enhanced by incorporating multi-agent systems using a framework like Autogpt, which can automate the iterative process of generating, reviewing, and refining the images.

Overall, the ability to generate highly customized, photorealistic images using AI opens up interesting possibilities for marketing, e-commerce, and other applications. As the technology continues to evolve, we can expect to see more innovative use cases emerge in this space.