🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🔧 AI Nachrichten ChatGPT automatically logged out [Fix](12.09.2026 um 17:09 Uhr)
⚠️ Malware / Trojaner / VirenWindows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC(10.09.2026 um 20:11 Uhr)
🪟 Windows TippsServertimeout in Outlook über 10 Minuten verlängern(12.09.2026 um 15:10 Uhr)
🔧 AI Nachrichten Stealing AI Reasoning Traces(08.09.2026 um 12:20 Uhr)
🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🔧 AI Nachrichten ChatGPT automatically logged out [Fix](12.09.2026 um 17:09 Uhr)
⚠️ Malware / Trojaner / VirenWindows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC(10.09.2026 um 20:11 Uhr)
🪟 Windows TippsServertimeout in Outlook über 10 Minuten verlängern(12.09.2026 um 15:10 Uhr)
🔧 AI Nachrichten Stealing AI Reasoning Traces(08.09.2026 um 12:20 Uhr)

🔧 Programmierung 🕛 vor 5 Monaten 7 Min Lesezeit
0

How I Built an AI Birthday Photo Generator with Cloudflare Workers, Gemini 2.5 Flash, and FLUX.2 Pro

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

TL;DR: Upload a selfie → Gemini analyzes the photo and writes 3 birthday scene prompts → FLUX.2 Pro generates the images → Cloudflare R2 stores them. The whole backend runs on Cloudflare Workers with zero servers.




I recently launched






target_img






The Stack






CODE
Frontend: Next.js 15 (App Router) → static export → Cloudflare Pages
Backend: Cloudflare Workers (TypeScript)
Database: Cloudflare D1 (SQLite)
Storage: Cloudflare R2
Cache: Cloudflare KV (sessions)
Queue: Cloudflare Queues
AI: Gemini 2.5 Flash (via Replicate) + BFL FLUX.2 Pro
Payment: PayPal
Auth: Google OAuth






The entire backend runs on a single Cloudflare Worker. No EC2, no containers, no ops headaches.









The Core Pipeline



The generation flow looks like this:




CODE
User uploads photo

Worker validates + deducts credits + enqueues job

Queue consumer picks it up (runs up to 15 min)

Step 1: Gemini 2.5 Flash analyzes the photo → outputs 3 scene prompts (JSON)

Step 2: Submit 3 FLUX.2 Pro jobs sequentially → each fires a webhook when done

Webhook handler saves images to R2, finalizes task

User polls /api/task/:id → gets results






The key insight: use Cloudflare Queues to break the CPU/time limit of a single Worker request. Workers have a 30-second wall clock limit on HTTP requests, but Queue consumers can run for up to 15 minutes — enough time for Gemini + 3 FLUX calls.









Step 1: Gemini Analyzes the Photo



The hardest part wasn't the image generation. It was writing a prompt good enough to make Gemini output exactly what FLUX needs.



I use Gemini 2.5 Flash via Replicate's API. The system prompt is ~800 words and instructs Gemini to:




  1. Count people in the foreground (ignore background bystanders)

  2. Describe each person's face features in detail (for face preservation in the generated image)

  3. Design 3 completely different birthday scene themes

  4. Output a structured JSON with start_prompt, end_prompt, and 3 scenes



The JSON structure separates shared prompt parts from scene-specific content:




CODE
{
"people_count": 1,
"start_prompt": "This is the same person from the reference photo. Preserve their exact face shape...",
"end_prompt": "Shot on Canon EOS R5, 85mm f/1.4, photorealistic, 8K ultra HD",
"scenes": [
{ "name": "Golden_Gala", "prompt": "Glamorous gold ballroom with 40 metallic gold balloons..." },
{ "name": "Tropical_Paradise", "prompt": "Vibrant beach party setting with palm trees..." },
{ "name": "Enchanted_Garden", "prompt": "Magical outdoor garden with floral arches..." }
]
}






When submitting to FLUX, I assemble the full prompt as:




CODE
const fullPrompt = [analysis.start_prompt, scene.prompt, analysis.end_prompt]
.filter(Boolean)
.join(' ');






This makes it easy to tune the shared "face preservation" instructions without touching each scene prompt.









Step 2: FLUX.2 Pro Image Generation



I use — you get 10 free credits on signup (no credit card required).



Happy to answer any questions about the architecture in the comments!

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
The Gemini desktop app is now available for Windows
1 Quelle
ChatGPT automatically logged out [Fix]
1 Quelle
Windows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten How I Built an AI Birthday Photo Generator with Cloudflare Workers, Gemini 2.5 Flash, and FLUX.2 Pro

Thematisch verwandte Begriffe: Built, Birthday, Photo, Generator · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...