~shahper.shahin
Back to Selected Work
Applied AI & Multimodal SystemsYear 2026

ArtSpark — AI Creative Studio for Reverse-Engineering Visual Designs

Multimodal AI studio for prompt engineering, image style reverse-engineering, and high-fidelity text-to-image generation.

Next.js 14FastAPIPythonGoogle Gemini 2.5 FlashFreepik Flux APIPollinations.aiTailwind CSSNextAuth.js
01

The Problem

Most AI art tools require users to already know complex prompting syntax (lighting models, lens types, aesthetic modifiers). When users see an inspiring artwork, they have no systematic way to deconstruct its visual parameters into a reproducible prompt.

Engineered ArtSpark to automate prompt alchemy across three tiers of detail (Simple, Detailed, Ultra-Detailed) and provide multimodal image reverse-engineering using Google Gemini 2.5 Flash, paired with dependable generation endpoints.

02

The System & Architecture

Next.js 14 App Router frontend interacting with a FastAPI backend that orchestrates Gemini 2.5 Flash for vision/prompt refinement and delegates generation to Freepik (Flux) with Pollinations.ai fallback.

System Schematic

ArtSpark Multimodal Synthesis Pipeline

4 Components • 5 Data Paths
client

Studio Client

Next.js 14 UI

service

Inference API

FastAPI (Python)

service

Gemini 2.5 Flash

Vision & Prompt Alchemy

queue

Flux / Pollinations

Image Synthesis Pipeline

Execution Sequence & Interconnects
01Studio ClientInference APIPrompt Config / Image Upload
02Inference APIGemini 2.5 FlashMultimodal Vision Analysis
03Gemini 2.5 FlashInference APIDeconstructed Prompt Tokens
04Inference APIFlux / PollinationsGeneration Dispatch
05Flux / PollinationsStudio ClientRendered Canvas Output
03

My Engineering Work

  • Architected prompt expansion pipeline generating 3 granular tiers (Simple, Detailed, Ultra-Detailed) with selectable mood and lighting presets
  • Built multimodal vision endpoint in FastAPI utilizing Gemini 2.5 Flash to reverse-engineer prompts from uploaded images
  • Implemented automated fallback orchestration between Freepik Flux API and Pollinations.ai to guarantee generation availability
  • Designed responsive studio interface with dark theme aesthetics, custom sliders, and smooth Framer Motion transitions
prompt_alchemy.py
python
async def expand_prompt(base_prompt: str, tier: str, style: str) -> str:
    system_instruction = f"Transform user ideas into {tier} prompts with {style} aesthetic."
    response = await client.aio.models.generate_content(
        model="gemini-2.5-flash",
        contents=f"Subject: {base_prompt}",
        config=types.GenerateContentConfig(system_instruction=system_instruction, temperature=0.7)
    )
    return response.text
04

Decisions & Trade-offs

Challenge: Commercial image generation APIs occasionally hitting rate limits or intermittent timeouts

Solution: Implemented asynchronous polling in FastAPI with an automated fallback to Pollinations.ai when primary providers are unavailable

Engineering Trade-off: Fallback provider has slightly lower resolution but guarantees zero user-facing 500 errors

Challenge: Handling image payload transfers between Next.js and FastAPI without blocking the UI

Solution: Implemented base64 streaming and multipart uploads with asynchronous background processing

Engineering Trade-off: Requires temporary in-memory buffering on backend gateway
05

Validation & Limitations

// Evaluated & Working
  • Streamlined prompt-to-render workflow enabling non-technical creators to generate high-fidelity digital art
  • Robust fallback architecture maintaining uptime across provider rate-limit spikes
// Current Limitations & Next Steps
  • Image generation on free-tier fallbacks can experience variable generation latency during peak hours
  • Advanced canvas masking and inpainting are currently planned roadmap features
06

Evidence & Verification

Verify the implementation directly via source code, commit history, and setup documentation:

Ref: FastAPI OpenAPI documentation (/docs) and Next.js frontend setup instructions