Introducing Headshot AI, an open-source project from Leap AI that generates Professional AI Headshots in minutes.
Live demo here.
The app is powered by:
Just clone, configure, deploy and you have a Headshot AI SaaS in a box.
To create your own Headshot AI app, follow these steps:
To setup Supabase/Vercel and your github repo, click on the Vercel Deploy Button and follow the steps.
IMPORTANT: In the Supabase integration step: Make sure you leave the Create sample tables option checked. This might take a few minutes to complete.
The Vercel Deployment will create a new repository with this template on your GitHub account and guide your through a new Supabase project creation. The Supabase Vercel Deploy Integration will set up the necessary Supabase environment variables and run the SQL migrations to set up the Database schema on your account. You can inspect the created tables in your project's Table editor.
This will create the tables with their respective columns and RLS policies:
git clone {{your-repo-name}}
cd {{your-repo-name}}
Install dependencies:
For npm:
npm install
For yarn:
yarn
Magic Link Auth (Supabase)
In your supabase dashboard, make sure to update the email template for magic link correctly. You can use the following template:
Make sure to setup your site URL and redirect urls in the supabase dashboard under Authentication -> URL Configuration. For example: Site URL: https://headshots-starter.vercel.app Redirect URL: https://headshots-starter.vercel.app/**
<h2>Magic Link</h2>
<p>Follow this link to login:</p>
<p><a href="https://github.com/leap-ai/headshots-starter/blob/master/{{ .SiteURL }}/auth/confirm?token_hash={{ .TokenHash }}&type=email">Log In</a></p>
Create a Leap AI account
In your .env.local
file:
your_api_key
with your Leap API key
your-hosted-url/leap/train-webhook
with https://{your-hosted-url}/leap/train-webhookyour-hosted-url/leap/image-webhook
with https://{your-hosted-url}/leap/image-webhookyour-webhook-secret
with any arbitrary URL friendly string eg.shadf892yr398hq23h
Create a Resend account (Optional)
your-resend-api-key
with your Resend API Key if you wish to use Resend to email users when their model has finished training.Configure Stripe to bill users on a credit basis. (Optional)
The current setup is for a credit based system. 1 credit = 1 model train.
To enable Stripe billing, you will need to fill out the following fields in your .env.local
file:
You need to do multiple things to get Stripe working:
checkout.session.completed
event. The webhook should point to your-hosted-url/stripe/subscription-webhook
.<stripe-pricing-table
pricing-table-id="your-stripe-pricing-table-id"
publishable-key="your-stripe-publishable-key"
client-reference-id={user.id}
customer-email={user.email}
></stripe-pricing-table>
Here are the products you need to create to get Stripe working with our example, checkout the images Here
To create them go on the Stripe dashboard, search for Product Catalog and then click on the add product button on the top right of the screen. You will need to create 3 products, one for each credit package as shown in the images before. We set them to One time payments, but you can change that if you want to and you can set the price too. After creating the products make sure to update the variables in the .env.local [your-stripe-price-id-one-credit, your-stripe-price-id-three-credit, your-stripe-price-id-five-credit] with their respective price ids, each price id is found in the product page at the bottom.
Start the development server:
For npm:
npm run dev
For yarn:
yarn dev
Visit http://localhost:3000
in your browser to see the running app.
Default deploy using Vercel:
Deployment also supported on Replit.
The image samples used to teach the model what your face looks like are critical. Garbage in = garbage out.
If you get distorted results with multiple faces, repeated subjects, multiple limbs, etc, make sure to follow these steps and minimize the chance of this happening:
For more information on how to improve quality, read the blog here.
Headshot AI can be easily adapted to support many other use-cases on Leap AI including:
& more!
We welcome collaboration and appreciate your contribution to Headshot AI. If you have suggestions for improvement or significant changes in mind, feel free to open an issue!
If you want to contribute to the codebase make sure you create a new branch and open a pull request that points to dev
.
Headshot AI is released under the MIT License.