/super-me-photo-ai-api

Learn how to build an API that trains and generate photos featuring... you! Using FastAPI, Upstash, Replicate, Jupyter, and more

Primary LanguageJupyter NotebookMIT LicenseMIT

SuperMe - Generative Photo AI

Star this repo

Learn how to build an API that trains and generate photos featuring... you! Using FastAPI, Upstash, Replicate, Jupyter, and more

Tech Stack

  • Python 3.13
  • Django (pip install "Django>=5.1,<5.2")
  • Upstash - serverless redis, qstash for async endpoint scheduling, rate limiting, caching, and more.
  • Replicate - train and run generative ai model featuring your face
  • Python requests (pip install requests)
  • Jupyter (pip install jupyter)
  • Python Decouple to load environment variables (e.g. .env) with type casting and default values.
  • ostris/flux-dev-lora-trainer. Model made to allow you to fine-tune FLUX with your own images (pre-trained model designed for your training)

Tutorial

Getting Started

Download the following:

Open a command line (Terminal, VSCode Terminal, Cursor Terminal, Powershell, etc)

Clone this Repo

mkdir -p ~/dev/superme-api
cd ~/dev/superme-api
git clone https://github.com/codingforentrepreneurs/super-me-photo-ai-api .

Checkout the start branch

git checkout start

Make the code yours

rm -rf .git
git init
git add --all
git commit -m "I am the capitan now"

Create a Python vitual environment macOS/Linux/WSL

python3.12 -m venv venv
source venv/bin/activate

windows powershell

c:\Path\To\Python312\python.exe -m venv venv
.\venv\Scripts\activate

Install requirements

(venv) python -m pip install pip --upgrade
(venv) python -m pip install -r requirements.txt

To add support for .heic images (e.g. iPhone images) install libheif via homebrew:

brew install libheif
(venv) python -m pip install pillow-heif

If on linux or Docker, you can use sudo apt-get install libheif-dev