Sticker maker
The same generation call, but the app wraps your subject in a fixed style recipe
Showcase — Sticker maker
The same generation call, but the app wraps your subject in a fixed style recipe — die-cut, bold outline, flat colors, white background — so every result is on-brand. It's prompt templating aimed at images: the user brings the subject, the app brings the look.
Run
bash bootstrap-secrets.sh # reads ../../../../.env, writes secrets/
docker compose up --build # default: PROVIDER=openai
Open http://localhost:3000. Gemini: PROVIDER=gemini docker compose up --build.
What's where
backend/ai_openai.py/backend/ai_gemini.py— the style template around the user's subject, returning a data URI.frontend/app/page.tsx— subject box; renders the sticker.
Stop
docker compose down
Run locally
Download the project as a ZIP and run it with Docker. Brings up a FastAPI backend + Next.js frontend on localhost:3000.
unzip sticker-maker.zip
cd sticker-maker
bash bootstrap-secrets.sh # one-time: pulls API keys into ./secrets
docker compose up --build # default provider: openai
# or: PROVIDER=gemini docker compose up --build
Type some input, pick a provider, and run the same code shown in Source against the live API. Sign-in required.
The same modules the Run button hits. The whole project (frontend, Dockerfile, compose) is in the ZIP under README.
backend/ai_openai.py
"""Showcase 2 (OpenAI): sticker maker.
The same generate call, but the app wraps your subject in a fixed style recipe —
die-cut sticker, bold outline, flat colors, white background. Prompt templating
for images: the user supplies the subject, the app supplies the look, so every
result is on-brand.
"""
from openai import OpenAI
_client = OpenAI()
_MODEL = "gpt-image-1"
_STYLE = ("A die-cut sticker of {subject}. Bold clean outline, flat vibrant "
"colors, simple shading, centered on a plain white background, glossy "
"vinyl sticker style.")
def run(subject: str) -> str:
s = subject.strip()
if not s:
return "Describe the sticker subject (e.g. 'a happy avocado')."
response = _client.images.generate(model=_MODEL, prompt=_STYLE.format(subject=s), size="1024x1024")
return f"data:image/png;base64,{response.data[0].b64_json}"
backend/ai_gemini.py
"""Showcase 2 (Gemini): sticker maker via the image model.
Same style recipe wrapped around the user's subject; Gemini's image model via
generate_content.
"""
import base64
import os
from google import genai
from google.genai import types
_client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])
_MODEL = "gemini-2.5-flash-image"
_STYLE = ("A die-cut sticker of {subject}. Bold clean outline, flat vibrant "
"colors, simple shading, centered on a plain white background, glossy "
"vinyl sticker style.")
def _generate(prompt: str) -> str:
response = _client.models.generate_content(
model=_MODEL, contents=prompt,
config=types.GenerateContentConfig(response_modalities=["TEXT", "IMAGE"]),
)
for part in response.candidates[0].content.parts:
if getattr(part, "inline_data", None) and part.inline_data.data:
b64 = base64.b64encode(part.inline_data.data).decode()
return f"data:image/png;base64,{b64}"
return "No image was generated — try a different subject."
def run(subject: str) -> str:
s = subject.strip()
if not s:
return "Describe the sticker subject (e.g. 'a happy avocado')."
return _generate(_STYLE.format(subject=s))
Project files
.gitignoreREADME.es.mdREADME.mdbackend/Dockerfilebackend/ai_gemini.pybackend/ai_openai.pybackend/main.pybackend/requirements.txtbootstrap-secrets.shdocker-compose.ymlfrontend/Dockerfilefrontend/app/layout.tsxfrontend/app/page.tsxfrontend/next.config.tsfrontend/package.jsonfrontend/tsconfig.json