$ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' if (-not $env:FAL_KEY) { $env:FAL_KEY = [System.Environment]::GetEnvironmentVariable("FAL_KEY","User") } if (-not $env:FAL_KEY) { throw "FAL_KEY not set." } $auth = @{ Authorization = "Key $env:FAL_KEY" } $dir = "C:\Users\CAN\tinqs-ltd\tattoo-test\gen-v6" $log = "$dir\_gen-sleeves-v6.log" "START $(Get-Date -Format o)" | Out-File $log # v6 limb sleeves: SPARSE vertical compositions with v3-style negative space. # bake_v6.gd wraps these mirrored + aspect-true and samples only a centered # strip (arms ~46%, legs ~29% of the width), so the design must live in the # central column and breathe: bold isolated motif clusters, lots of parchment. $style = "Polynesian / Marquesan TRIBAL tattoo, solid black ink on off-white parchment. Bold black shapes with crisp edges, koru spirals, shark-tooth (niho) notches, sparing dotwork. Confident, elegant linework." $fill = "SPARSE VERTICAL SLEEVE COMPOSITION: one elegant column of 3-4 bold motif clusters flowing top to bottom in the CENTER of the canvas, separated by generous EMPTY parchment gaps. AT LEAST HALF of the canvas stays empty parchment - the design must breathe like a classic Maori arm sleeve. The composition starts at the very TOP EDGE with one strong horizontal terminal band; below it the clusters get smaller and sparser toward the bottom edge. The left and right outer edges of the canvas stay mostly empty." $neg = "No color, no grey shading, no gradients, no photoreal, no 3D, no human figure, no text, no outer border or frame, no vignette, no dense edge-to-edge pattern fill, no background texture." $jobs = @( @{ part="arm_r"; mark="chiefs-mark"; d="Theme - CHIEF'S CREST: the terminal band is a spearhead crown with a short fan of broad rays; below it one large koru spiral cluster, then a slim niho tooth band, then one small isolated spiral near the bottom." } @{ part="arm_l"; mark="iron-spine"; d="Theme - IRON SPINE (warrior): the terminal band is a row of interlocked spearhead chevrons; below it two bold crossed spears with barbed heads as the main motif, then a slim shark-tooth band, then one small chevron mark near the bottom." } @{ part="leg_r"; mark="voyagers-current"; d="Theme - VOYAGER'S CURRENT (ocean): the terminal band is a row of wave scrolls; below it one large curling koru wave as the main motif, then a slim flowing current line with a single spiral eddy, then one small wave mark near the bottom." } @{ part="leg_l"; mark="storm-bearer"; d="Theme - STORM BEARER: the terminal band is a row of storm-cloud koru scrolls; below it one bold jagged lightning bolt as the main motif, then a slim zigzag rain band, then one small bolt mark near the bottom." } ) $perImage = 0.17 # GPT Image 2, quality=high (estimate) $runCost = 0.0; $ok = 0; $fail = 0; $skip = 0 foreach ($j in $jobs) { $name = "v6_$($j.part)_$($j.mark)" $path = "$dir\$name.png" if (Test-Path $path) { $skip++; "SKIP $name (exists)" | Tee-Object -FilePath $log -Append | Out-Null; continue } Write-Host "=== $name ===" -ForegroundColor Cyan $prompt = "$style`n$fill`n$($j.d)`nSTRICT: $neg" try { $body = @{ prompt=$prompt; image_size="portrait_4_3"; quality="high"; num_images=1 } | ConvertTo-Json -Depth 6 -Compress $resp = Invoke-RestMethod -Method Post -Uri "https://fal.run/openai/gpt-image-2" -Headers $auth -ContentType 'application/json' -Body $body -TimeoutSec 600 Invoke-WebRequest -Uri $resp.images[0].url -OutFile $path -TimeoutSec 300 $runCost += $perImage; $ok++ "OK $name" | Tee-Object -FilePath $log -Append | Out-Null Write-Host " OK" -ForegroundColor Green } catch { $fail++ "FAIL $name : $($_.Exception.Message) $($_.ErrorDetails.Message)" | Tee-Object -FilePath $log -Append | Out-Null Write-Host " FAIL: $($_.Exception.Message)" -ForegroundColor Red } } "DONE ok=$ok fail=$fail skip=$skip RUN_COST_USD=$([math]::Round($runCost,2)) $(Get-Date -Format o)" | Tee-Object -FilePath $log -Append Write-Host ("RUN_COST_USD={0:N2} ok={1} fail={2} skip={3}" -f $runCost,$ok,$fail,$skip) -ForegroundColor Yellow