This Flask app turns a single product photo into a 3×3 lifestyle collage (PNG + PDF) using Bria’s Product Shot Editing APIs.
- Upload one product image (JPG/PNG/WebP ≤ 12 MB).
- Server-side creates a transparent packshot, then nine lifestyle variations with different placements.
- Results saved under
static/outputs/<session_id>/:items/1.png…items/9.pnggrid.png(3×3 montage)catalog.pdf
- Background worker tracks progress; front-end polls
/progress/<job_id>. - Guards against oversized uploads and oversized downloads from Bria.
- Python 3.11+
- Bria API token with access to the Lifestyle endpoints.
python3 -m venv .venv
. .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
export BRIA_API_TOKEN=your_token_here # Powers all API callsflask --app app.py run --reloadThen open http://127.0.0.1:5000.
app.py # Flask app, background job orchestration
templates/ # index, progress, result pages
static/css/styles.css # UI styling
static/outputs/ # Generated results (per session)
requirements.txt # Python dependencies
BRIA_API_TOKEN(required): Auth token for Bria APIs.
- File uploads are size-limited to 12 MB before any processing.
- Downloads from Bria are streamed and capped at 25 MB to avoid memory exhaustion.
- Werkzeug access logs are suppressed (warnings and above only) so app logs stay readable.
- 403 response from Flask: check that
app.pyran successfully and the templates are accessible. - Bria API errors: confirm the token is valid and that your account has access to the Lifestyle endpoints.
- Oversized upload error: resize the source image to ≤ 12 MB.