Build Your Own AI Avatar Generator (2023)

No one could have predicted how viral Magic Avatar would go when Prisma Labs released it as a TikTok filter―with $2.5 million per day in revenue at its peak, the AI-powered avatar generator was one of the biggest successes of 2022. But what if you could build your own AI avatar generator, with your own style, for a fraction of the cost? This is what we're going to do in this article.

1. Getting Started

To get started, simply select the avatarTrainer template from our available Rowy templates:

Then, the only remaining prerequisite is to log in your Replicate account and obtain an API token. Replicate is a low-code web service for easily training and deploying machine learning models using an API, hence the need to get an API key:

Replicate API token - 1.jpg

2. Adding Images For Training

Our AI avatar generator is based on DreamBooth, an AI model to generate images from a given object or art style based on a text prompt.

By default, the model is incapable of creating a picture that looks like you, so we need a way to teach the model how to do that. This part is called 'training'.

With the Rowy template you cloned in step 1, everything is ready for you to train a custom model. You just need to upload pictures of yourself in the 'Add Images For Training' column of the table:

the training column - 2.jpg

When choosing pictures, use a variety of angles and situations. The more pictures you upload, the better the model will be able to generate outputs that look like you. In this example, 9 pictures were enough to obtain a satisfying result.

3. Training A New Model

Then, just add a unique token to describe your training images and a Replicate model name in the form username/modelname. You can also specify a class type to help with the training process:

training parameters - 3.jpg

All you have to do left is click the 'Train Model' button to start the training process.

Rowy simply performs an API call to Replicate to perform the training process with your image samples. You'll need to specify your API token as a Rowy secret in the Action column settings:

Action column settings - 4.jpg

Once the training completes, Replicate will send a response to Rowy with the model's ID using a Rowy webhook:

Rowy webhook - 5.jpg

You'll need to define this webhook URL in the aforementionned Action column as well.

The training will take a few minutes to complete, up to 30 minutes.

4. Generating Images

Now your model has been trained, it is ready to generate new images of you in a different art style!

To do that, click on the 'Generate Images' subtable and enter an optional prompt and an art style for your avatar:

Generate Images subtable - 6.jpg

Then, click the 'Generate' button to generate a new image. It should only take a few seconds to obtain your final result. Here are a few examples with 5 different styles:

Generated images with different styles - 8.jpg

Again, Rowy takes care of the API call to Replicate to generate the image:

Generate image action - 7.jpg

Cost Breakdown

AI software is expensive to run, as it requires dedicated hardware like GPU and powerful processors. With Replicate, prices start from $0.138 per minute of runtime, with a free tiers:

ReplicateAI pricing tiers - 0.jpg

According to the official Replicate website, the DreamBooth model we use takes about 15 seconds to complete a generation. But keep in mind you also need to take into account the initial training time―about 30 minutes at most.

For this demo, the total cost would be less than $5 for hundreds of AI avatars with unlimited creative choices.

Improvement Ideas

This demo is a simple proof of concept, and there are many ways to adapt it to your own use cases.

For example, you can use Rowy webhooks to upload images from a front-end app, or train a DreamBooth model to generate other things than avatars―logos, images in a particular art style, etc.

Your imagination is the only limit! So go out there and build something mind-blowing.

Join Our Community

And that's how you build your very own powerful AI avatar generator with Rowy and Replicate. Train with some images, order new pictures, and share the results with the world!

If you have any questions, feel free to join our Discord community.

Get started with Rowy in minutes

Continue reading

Browse all