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)
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 startMake 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/activatewindows powershell
c:\Path\To\Python312\python.exe -m venv venv
.\venv\Scripts\activateInstall requirements
(venv) python -m pip install pip --upgrade
(venv) python -m pip install -r requirements.txtTo add support for .heic images (e.g. iPhone images) install libheif via homebrew:
brew install libheif
(venv) python -m pip install pillow-heifIf on linux or Docker, you can use sudo apt-get install libheif-dev