Files
linkspin/tools/niche-heroes.py

64 lines
5.4 KiB
Python

# Niche hero sets for LinkSpin pages (Marty 2026-10-08): three more photographic heroes per existing niche + four for a
# new Gaming niche. kie.ai nano-banana-pro via the BannerKitAI generator, textless, 1536x1024 like the originals.
import os, subprocess, sys, pathlib, time
HERE = pathlib.Path(__file__).parent; OUT = HERE / 'gen'; OUT.mkdir(exist_ok=True)
GEN = r'D:\Projects\BannerKitAI\render\scripts\generate-banner-image.py'
key = open(r'C:\Users\Marty\.kie-key').read().strip()
env = dict(os.environ, KIE_API_KEY=key, PYTHONIOENCODING='utf-8')
STYLE = (' Editorial photograph shot on a full-frame camera with a 35mm lens, shallow depth of field, natural or practical light, '
'photorealistic, high-end magazine quality, muted cinematic color grade, no illustration, no cartoon, no vector look. '
'Absolutely no text, no words, no letters, no logos, no watermarks anywhere, screens show only abstract shapes or soft colour. '
'Full-bleed: the camera is inside the scene and the scene extends past all four edges, no frame, no border, no mockup.')
SHOTS = {
'health-wellness': [
'A woman in her thirties doing a morning yoga stretch on a weathered wooden deck above a calm sea, soft sunrise haze, a rolled mat and a glass of water beside her.',
'A bright kitchen counter with a fresh smoothie bowl topped with berries and seeds, a glass of green juice, sliced citrus, and morning light through a window.',
'A runner crouched to tie a shoe on a forest trail at sunrise, light rays through the trees, dew on the grass, water bottle on a rock.',
],
'make-money-online': [
'A young man working on a laptop at a sunlit cafe table, flat white beside him, phone face up showing a soft glowing abstract notification, city street blurred behind the window.',
'A cosy home office at night, two monitors glowing with abstract colourful charts, warm desk lamp, headphones on a stand, a cat asleep on the chair arm.',
'A laptop open on a hammock between palm trees at a tropical beach, turquoise water, a coconut with a straw, late afternoon light.',
],
'personal-finance': [
'Close-up of hands writing in a leather notebook on a dark walnut desk, a calculator, a small stack of coins, a cup of black coffee, warm side light.',
'A glass jar filled with coins with a tiny green seedling sprouting from the top, on a rustic wooden table by a window, golden hour light.',
'A couple at a kitchen table in the morning reviewing papers together, laptop open, two mugs, calm and confident mood, soft daylight.',
],
'coaching-consulting': [
'A confident coach in a blazer speaking to a small group of six adults seated in a bright industrial loft with exposed brick and large windows.',
'Two people in a one-on-one conversation across a small wooden table, an open notebook and a tablet between them, a plant and window light behind.',
'A presenter gesturing at a whiteboard covered in abstract diagrams, arrows and shapes only, in a modern meeting room, listeners slightly out of focus in the foreground.',
],
'self-improvement': [
'A person journaling in a notebook by a tall window at dawn, blanket over the shoulders, a mug steaming, the city soft and blue outside.',
'A hiker standing at a rocky summit at golden hour looking over layered mountain ridges, backpack on, wind in the jacket.',
'A stack of hardcover books with reading glasses on top, a cup of tea and a small lamp, warm evening light on a linen tablecloth.',
],
'relationships': [
'A couple walking hand in hand along the shoreline at sunset, waves washing over their feet, warm orange and pink sky.',
'Two close friends laughing over coffee at a corner table in a warm cafe, afternoon light, croissants on a plate.',
'A couple cooking together in a warm kitchen, chopping vegetables and smiling, steam rising from a pan, pendant lights glowing.',
],
'gaming': [
'A gaming desk at night with an RGB-lit mechanical keyboard, a headset on a stand, and an ultrawide monitor glowing with abstract colourful game visuals, purple and teal light.',
'Hands holding a handheld game console on a couch in a dim living room lit by neon strip lights, a bowl of popcorn and an energy drink on the table.',
'An esports arena stage with dramatic blue and magenta lighting, a crowd silhouetted in the foreground, haze in the air, large screens showing abstract light.',
'A row of glowing retro arcade cabinets in a dim arcade hall, colourful screens showing only abstract shapes, reflections on a polished floor.',
],
}
only = sys.argv[1:] # optional: niche keys to (re)generate
for niche, prompts in SHOTS.items():
if only and niche not in only: continue
start = 2 if niche != 'gaming' else 1
for i, p in enumerate(prompts):
out = OUT / f'{niche}-{start + i}.png'
if out.exists() and out.stat().st_size > 50000: print('skip', out.name); continue
for attempt in range(2):
r = subprocess.run([sys.executable, GEN, '--prompt', p + STYLE, '--width', '1536', '--height', '1024', '--no-text', '--filename', str(out)], env=env, capture_output=True, text=True)
ok = out.exists() and out.stat().st_size > 50000
print(('ok ' if ok else 'FAIL') + ' ' + out.name, (r.stdout + r.stderr).strip().splitlines()[-1][:160] if (r.stdout + r.stderr).strip() else '', flush=True)
if ok: break
time.sleep(5)
print('DONE')