goumsss Claude Opus 4.8 commited on
Commit
18bda20
Β·
1 Parent(s): 2b1f846

Dataset: FLUX.2-dev + app-aligned prompts with multi-animal/place combos

Browse files

image_generator.py:
- Extract build_subject(animals, places) β†’ "A cute {animals} {places}"
shared core; build_prompt now = build_subject + ", " + NUMZOO_STYLE
- Add _join() helper for the 1–3 phrase joining

scripts/generate_dataset.py:
- Switch model to FLUX.2-dev (via fal-ai provider, HF Pro credits)
- Rebuild prompts programmatically from the app's exact ANIMAL_MAP /
PLACE_MAP using the shared build_subject β€” captions are byte-identical
in structure to live app prompts, just with a rich scene-detail clause
- 54 curated scenes: all 12 animals solo, all 10 places, plus deliberate
2–3 animal and 2–3 place combinations mirroring multi-emoji selections

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Files changed (2) hide show
  1. image_generator.py +17 -20
  2. scripts/generate_dataset.py +111 -205
image_generator.py CHANGED
@@ -174,30 +174,27 @@ NUMZOO_STYLE = (
174
  # Prompt builder
175
  # ---------------------------------------------------------------------------
176
 
177
- def build_prompt(animals: list[str], places: list[str]) -> str:
178
- # Use ALL selected animals and places (up to 3 each)
 
 
 
 
 
 
 
 
 
 
179
  animal_list = animals[:3] if animals else [random.choice(list(ANIMAL_MAP))]
180
  place_list = places[:3] if places else [random.choice(list(PLACE_MAP))]
 
 
 
181
 
182
- # Build animal text: "puppy", "puppy and bunny", "puppy, bunny and kitten"
183
- animal_names = [ANIMAL_MAP.get(a, "bunny") for a in animal_list]
184
- if len(animal_names) == 1:
185
- animal_text = animal_names[0]
186
- elif len(animal_names) == 2:
187
- animal_text = f"{animal_names[0]} and {animal_names[1]}"
188
- else:
189
- animal_text = f"{animal_names[0]}, {animal_names[1]} and {animal_names[2]}"
190
-
191
- # Build place text: "in a garden", "in a garden and under a rainbow", ...
192
- place_texts = [PLACE_MAP.get(p, "in a magical garden") for p in place_list]
193
- if len(place_texts) == 1:
194
- place_text = place_texts[0]
195
- elif len(place_texts) == 2:
196
- place_text = f"{place_texts[0]} and {place_texts[1]}"
197
- else:
198
- place_text = f"{place_texts[0]}, {place_texts[1]} and {place_texts[2]}"
199
 
200
- return f"A cute {animal_text} {place_text}, {NUMZOO_STYLE}"
 
201
 
202
  # ---------------------------------------------------------------------------
203
  # Pipeline loader (cached globally β€” survives between ZeroGPU calls)
 
174
  # Prompt builder
175
  # ---------------------------------------------------------------------------
176
 
177
+ def _join(parts: list[str]) -> str:
178
+ """Join 1–3 phrases: 'a', 'a and b', 'a, b and c'."""
179
+ if len(parts) == 1:
180
+ return parts[0]
181
+ if len(parts) == 2:
182
+ return f"{parts[0]} and {parts[1]}"
183
+ return f"{parts[0]}, {parts[1]} and {parts[2]}"
184
+
185
+
186
+ def build_subject(animals: list[str], places: list[str]) -> str:
187
+ """The 'A cute {animals} {places}' core β€” SHARED with scripts/generate_dataset.py
188
+ so training captions and live prompts use the exact same structure & vocabulary."""
189
  animal_list = animals[:3] if animals else [random.choice(list(ANIMAL_MAP))]
190
  place_list = places[:3] if places else [random.choice(list(PLACE_MAP))]
191
+ animal_text = _join([ANIMAL_MAP.get(a, "bunny") for a in animal_list])
192
+ place_text = _join([PLACE_MAP.get(p, "in a magical garden") for p in place_list])
193
+ return f"A cute {animal_text} {place_text}"
194
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
 
196
+ def build_prompt(animals: list[str], places: list[str]) -> str:
197
+ return f"{build_subject(animals, places)}, {NUMZOO_STYLE}"
198
 
199
  # ---------------------------------------------------------------------------
200
  # Pipeline loader (cached globally β€” survives between ZeroGPU calls)
scripts/generate_dataset.py CHANGED
@@ -1,33 +1,33 @@
1
  """
2
  NumZoo training dataset generator.
3
 
4
- Generates 80 images matching the NumZoo aesthetic using FLUX.1-dev via the
5
- HuggingFace Inference API (fal-ai provider β€” best quality, free credits on signup).
6
 
7
- - Kawaii chibi animals with big sparkling eyes
8
- - Rich scene backgrounds (no white background)
9
- - Warm pastel palette, fairy lights, cozy props
10
- - Square 1024Γ—1024 output to match the app layout
 
 
 
11
 
12
  Output: training/image_001.jpg + training/image_001.txt (caption)
13
 
14
  Requirements:
15
- pip install huggingface_hub pillow python-dotenv
16
 
17
  Setup (HF Pro β€” just your existing token):
18
- 1. Get your HF token at https://huggingface.co/settings/tokens
19
- (fine-grained, with "Make calls to Inference Providers" permission)
20
- 2. Add to .env:
21
- HF_TOKEN=hf_...
22
-
23
- With HF Pro your token already has credits on fal-ai, replicate, together etc.
24
- No separate provider account needed.
25
 
26
  Usage:
27
- python scripts/generate_dataset.py # all 80 via fal-ai (FLUX.1-dev)
28
- python scripts/generate_dataset.py --count 5 # first 5 only (test run)
29
- python scripts/generate_dataset.py --start 41 # resume from image 41
30
- python scripts/generate_dataset.py --provider hf-inference # HF native (schnell)
31
  """
32
 
33
  import os
@@ -43,206 +43,112 @@ try:
43
  except ImportError:
44
  pass # dotenv optional β€” can also export GEMINI_API_KEY manually
45
 
46
- # Import the canonical style string from image_generator so training captions
47
- # and live prompts are always identical.
48
  sys.path.insert(0, str(Path(__file__).parent.parent))
49
- from image_generator import NUMZOO_STYLE as STYLE # noqa: E402
 
 
 
 
 
50
 
51
  # ---------------------------------------------------------------------------
52
- # 80 prompts β€” 8 scene categories Γ— 10 animals
53
- # STYLE is appended to every prompt so the LoRA learns it as a trigger
 
 
 
54
  # ---------------------------------------------------------------------------
55
 
56
- PROMPTS: list[tuple[str, str]] = [
57
- # ── 1. Cozy cabin interior ──────────────────────────────────────────────
58
- ("cozy_cabin_01", f"a fluffy bunny curled on an armchair by a stone fireplace inside a wooden cabin, "
59
- f"pastel star blanket, string lights, hot cocoa on a tree-stump table, warm amber glow, {STYLE}"),
60
- ("cozy_cabin_02", f"a sleepy kitten reading a tiny book in a cozy log cabin, "
61
- f"fairy lights strung above wooden shelves with colorful jars, fireplace crackling, "
62
- f"pastel pink and lavender tones, {STYLE}"),
63
- ("cozy_cabin_03", f"a baby bear in a rainbow scarf sitting at a round wooden table with pancakes "
64
- f"inside a cabin, soft morning light through an arched window, {STYLE}"),
65
- ("cozy_cabin_04", f"a hedgehog wrapped in a cloud-print blanket watching raindrops on a cabin window, "
66
- f"string lights reflected in the glass, soft purple tones, {STYLE}"),
67
- ("cozy_cabin_05", f"a baby fox and a bunny sharing hot tea by a fireplace in a treehouse cabin, "
68
- f"wooden bookshelves, pastel mugs, twinkle lights, {STYLE}"),
69
- ("cozy_cabin_06", f"a tiny owl perched on a branch reading a glowing book inside a lantern-lit cabin, "
70
- f"warm golden light, mossy windowsill with flowers outside, {STYLE}"),
71
- ("cozy_cabin_07", f"a baby deer sitting on a plaid cushion inside a snug wooden cabin, "
72
- f"potted cactus and tiny succulents on shelves, fairy lights overhead, {STYLE}"),
73
- ("cozy_cabin_08", f"a raccoon stirring a sparkling potion in a cozy cabin kitchen, "
74
- f"mason jars of colorful ingredients, star-shaped window, warm light, {STYLE}"),
75
- ("cozy_cabin_09", f"a baby penguin in a striped scarf napping on a pastel sofa next to a glowing fireplace, "
76
- f"snow visible through the cabin window, {STYLE}"),
77
- ("cozy_cabin_10", f"a squirrel decorating a tiny pine tree inside a cabin with star ornaments and ribbon, "
78
- f"fairy lights everywhere, soft pink tones, {STYLE}"),
79
-
80
- # ── 2. Enchanted forest β€” day ───────────────────────────────────────────
81
- ("forest_day_01", f"a bunny in a daisy field inside an enchanted forest, "
82
- f"sunbeams through tall trees, floating sparkles, colorful mushrooms, {STYLE}"),
83
- ("forest_day_02", f"a kitten playing with a butterfly on a mossy log in a sunlit magical forest, "
84
- f"wildflowers in pastel pink and lilac, {STYLE}"),
85
- ("forest_day_03", f"a baby bear discovering a tiny glowing door in a tree trunk in an enchanted forest, "
86
- f"soft golden afternoon light, flower garlands, {STYLE}"),
87
- ("forest_day_04", f"a hedgehog gathering strawberries in a forest clearing, "
88
- f"pastel checkered picnic blanket, wicker basket, soft dappled sunlight, {STYLE}"),
89
- ("forest_day_05", f"a baby fox sitting on a giant mushroom in a magical forest, "
90
- f"fairy dust floating around, colorful birds in branches above, {STYLE}"),
91
- ("forest_day_06", f"an owl in a graduation cap perched on a tree branch in a sunlit forest, "
92
- f"hanging star lanterns, flowers blooming below, {STYLE}"),
93
- ("forest_day_07", f"a baby deer drinking from a sparkling stream in a lush forest, "
94
- f"rainbow trout visible in the water, cherry blossoms drifting, {STYLE}"),
95
- ("forest_day_08", f"a raccoon painting a tiny canvas in a forest studio made of logs and branches, "
96
- f"colorful paint pots, sunlight streaming in, {STYLE}"),
97
- ("forest_day_09", f"a baby penguin waddling through a magical spring forest with tulips taller than it, "
98
- f"pastel butterflies, {STYLE}"),
99
- ("forest_day_10", f"a squirrel and a bunny having a tea party on a giant leaf in the forest, "
100
- f"acorn cups, mushroom chairs, sunlit clearing, {STYLE}"),
101
-
102
- # ── 3. Magical forest β€” night / campfire ────────────────────────────────
103
- ("forest_night_01", f"a bunny and a kitten roasting marshmallows over a small campfire in a night forest, "
104
- f"crescent moon, fireflies, string lights in the trees, {STYLE}"),
105
- ("forest_night_02", f"a baby bear stargazing in a moonlit forest clearing, lying on a cloud-print blanket, "
106
- f"glowing constellations above, lantern beside, {STYLE}"),
107
- ("forest_night_03", f"a baby fox with a tiny lantern walking a forest path at night, "
108
- f"glowing mushrooms lining the path, crescent moon, {STYLE}"),
109
- ("forest_night_04", f"a hedgehog sleeping under a luminescent mushroom at night in the forest, "
110
- f"fireflies around, purple and blue tones, soft moonlight, {STYLE}"),
111
- ("forest_night_05", f"an owl sitting on a branch under the stars playing a tiny ukulele for forest friends "
112
- f"gathered below, night forest, fairy lights, {STYLE}"),
113
- ("forest_night_06", f"a baby deer watching shooting stars from a mossy hilltop at night, "
114
- f"forest silhouette below, soft purple sky, sparkles, {STYLE}"),
115
- ("forest_night_07", f"a raccoon cooking s'mores at a campfire in a night forest, "
116
- f"camping tent with fairy lights, moon and stars above, {STYLE}"),
117
- ("forest_night_08", f"a baby penguin looking at its reflection in a glowing moonlit pond in a night forest, "
118
- f"lily pads with tiny lights, {STYLE}"),
119
- ("forest_night_09", f"a squirrel telling stories around a campfire to bunny and kitten, night forest, "
120
- f"warm firelight, stars through the tree canopy, {STYLE}"),
121
- ("forest_night_10", f"a kitten catching fireflies in a jar at the edge of a glowing forest at dusk, "
122
- f"silhouette trees, warm golden light, {STYLE}"),
123
-
124
- # ── 4. Treehouse ────────────────────────────────────────────────────────
125
- ("treehouse_01", f"a bunny inside a cozy treehouse at sunset, rope bridge entrance, "
126
- f"flower window box, warm light glowing inside, {STYLE}"),
127
- ("treehouse_02", f"a kitten at the door of a treehouse with a welcome sign, "
128
- f"string lights along the railing, forest view at golden hour, {STYLE}"),
129
- ("treehouse_03", f"a baby bear and a hedgehog playing board games on the treehouse porch, "
130
- f"paper lanterns, leafy canopy above, {STYLE}"),
131
- ("treehouse_04", f"a baby fox gazing at the stars through a treehouse telescope at night, "
132
- f"spiral staircase, crescent moon, {STYLE}"),
133
- ("treehouse_05", f"an owl's cozy treehouse library with tiny glowing books and a reading nook, "
134
- f"ivy covered walls, daytime, {STYLE}"),
135
- ("treehouse_06", f"a baby bear watering flower boxes on a treehouse balcony, "
136
- f"bees and butterflies, golden afternoon light, leafy forest below, {STYLE}"),
137
- ("treehouse_07", f"a hedgehog and a squirrel stringing fairy lights around a treehouse at dusk, "
138
- f"warm glow, birds watching from nearby branches, {STYLE}"),
139
- ("treehouse_08", f"a baby fox sliding down a spiral slide from a treehouse into a pile of leaves, "
140
- f"autumn forest, rope ladder, golden light, {STYLE}"),
141
- ("treehouse_09", f"a baby deer reading a glowing map inside a treehouse at night, "
142
- f"star-shaped windows, moonlight, cozy lanterns, {STYLE}"),
143
- ("treehouse_10", f"a raccoon and a bunny cooking soup in a tiny treehouse kitchen, "
144
- f"steam rising, herbs hanging, sunlight through small windows, {STYLE}"),
145
-
146
- # ── 5. Garden / meadow β€” day ────────────────────────────────────────────
147
- ("garden_01", f"a bunny watering oversized tulips in a magical garden, "
148
- f"pastel blue watering can, butterflies, soft morning light, {STYLE}"),
149
- ("garden_02", f"a kitten napping in a flower hammock in a sunny garden, "
150
- f"roses and lavender around, bees buzzing, {STYLE}"),
151
- ("garden_03", f"a baby bear picking giant strawberries in a garden, "
152
- f"ladybugs on leaves, warm afternoon sun, picket fence, {STYLE}"),
153
- ("garden_04", f"a hedgehog rolling through a field of sunflowers, "
154
- f"pastel sky, birds above, soft breeze, {STYLE}"),
155
- ("garden_05", f"a baby fox blowing dandelion seeds in a meadow, "
156
- f"seeds glowing like stars, cherry trees in background, {STYLE}"),
157
- ("garden_06", f"a baby deer in a rain boots splashing in a puddle in a garden after rain, "
158
- f"rainbow in the sky, wet flowers, {STYLE}"),
159
- ("garden_07", f"a raccoon painting a garden fence with rainbow stripes, "
160
- f"paint buckets, butterflies landing on fresh paint, {STYLE}"),
161
- ("garden_08", f"a baby penguin planting seeds in a tiny garden plot, "
162
- f"little labeled plant markers, pastel gloves and apron, {STYLE}"),
163
- ("garden_09", f"a squirrel collecting colorful autumn leaves in a basket in a golden meadow, "
164
- f"maple trees, soft warm light, {STYLE}"),
165
- ("garden_10", f"a bunny and kitten flying a star-shaped kite in an open meadow, "
166
- f"puffy clouds, wildflowers below, {STYLE}"),
167
-
168
- # ── 6. Beach / waterfront ───────────────────────────────────────────────
169
- ("beach_01", f"a bunny building a sand castle on a pastel beach at sunset, "
170
- f"sea shells, gentle waves, pink and orange sky, {STYLE}"),
171
- ("beach_02", f"a kitten surfing a tiny wave on a pastel board, "
172
- f"tropical beach, palm trees, clear turquoise water, {STYLE}"),
173
- ("beach_03", f"a baby bear making friends with a crab on the beach, "
174
- f"rock pools with anemones, soft summer light, {STYLE}"),
175
- ("beach_04", f"a baby fox asleep in a hammock strung between two palm trees on a beach, "
176
- f"coconuts, ocean at dusk, {STYLE}"),
177
- ("beach_05", f"a baby penguin waddling along a sandy beach collecting glowing starfish at night, "
178
- f"bioluminescent waves, crescent moon, {STYLE}"),
179
- ("beach_06", f"a bunny and a hedgehog sharing a watermelon slice on a colorful beach towel, "
180
- f"sunny beach, parasol, gentle waves, {STYLE}"),
181
- ("beach_07", f"a baby fox building a sand boat on the beach, "
182
- f"pebble sail, seagulls, golden sunset, {STYLE}"),
183
- ("beach_08", f"a baby bear snorkeling in a clear lagoon, colorful fish and coral below, "
184
- f"tropical beach, bright midday light, {STYLE}"),
185
- ("beach_09", f"a kitten watching the sunset from a dock over calm ocean water, "
186
- f"orange and pink sky, lantern beside, soft waves, {STYLE}"),
187
- ("beach_10", f"a baby deer and a squirrel collecting shells in tide pools at low tide, "
188
- f"pastel sunset, starfish, {STYLE}"),
189
-
190
- # ── 7. Snowy winter ──────────────────────────────────────────────────────
191
- ("snow_01", f"a bunny building a snowman in a snowy forest clearing, "
192
- f"carrot nose, scarf, snowflakes falling, soft pink sky, {STYLE}"),
193
- ("snow_02", f"a kitten ice skating on a frozen pond in a winter forest, "
194
- f"snowflakes, pine trees with snow caps, fairy lights on branches, {STYLE}"),
195
- ("snow_03", f"a baby bear sledding down a snowy hill at night, "
196
- f"moonlight, sparkling snow, cozy village lights below, {STYLE}"),
197
- ("snow_04", f"a hedgehog warming up by a bonfire in the snow, "
198
- f"hot chocolate in tiny paws, snowflakes floating, pine forest, {STYLE}"),
199
- ("snow_05", f"a baby fox wrapped in a giant scarf making snow angels in a winter field, "
200
- f"snowflakes, soft blue and white tones, {STYLE}"),
201
- ("snow_06", f"an owl delivering a tiny letter through falling snow to a cabin, "
202
- f"warm window glow, snow-covered trees, {STYLE}"),
203
- ("snow_07", f"a baby deer with snowflakes on its nose in a quiet snowy forest, "
204
- f"bare tree branches with icicles, soft grey-blue light, {STYLE}"),
205
- ("snow_08", f"a raccoon and a squirrel having a snowball fight in a park, "
206
- f"snow-covered benches, winter lanterns, {STYLE}"),
207
- ("snow_09", f"a baby penguin sliding down an icy path to the frozen ocean, "
208
- f"auroras in the sky, soft blue and green glow, {STYLE}"),
209
- ("snow_10", f"a bunny and kitten sharing a pastel umbrella in gently falling snow, "
210
- f"fairy lights on trees, warm glow from a cafΓ© window, {STYLE}"),
211
-
212
- # ── 8. Autumn / rainy day ────────────────────────────────────────────────
213
- ("autumn_01", f"a bunny jumping in a pile of colorful autumn leaves in a park, "
214
- f"orange and red maples, soft afternoon sun, {STYLE}"),
215
- ("autumn_02", f"a kitten at a rainy window with a cup of tea, "
216
- f"raindrops on glass, cozy sweater, autumn forest visible outside, {STYLE}"),
217
- ("autumn_03", f"a baby bear in a pumpkin patch at golden hour, "
218
- f"scarecrow, autumn leaves drifting, {STYLE}"),
219
- ("autumn_04", f"a hedgehog foraging mushrooms in an autumn forest, "
220
- f"golden light through orange leaves, red berries, {STYLE}"),
221
- ("autumn_05", f"a baby fox jumping through autumn leaves in a red-orange forest, "
222
- f"bokeh light, warm amber tones, {STYLE}"),
223
- ("autumn_06", f"an owl in a cozy raincoat standing under a colorful mushroom in the rain, "
224
- f"puddles reflecting fairy lights, {STYLE}"),
225
- ("autumn_07", f"a baby deer watching the first autumn rain from under a giant leaf, "
226
- f"golden forest background, raindrops sparkle, {STYLE}"),
227
- ("autumn_08", f"a raccoon selling hot apple cider from a tiny wooden cart in an autumn market, "
228
- f"string lights, orange and red leaves, {STYLE}"),
229
- ("autumn_09", f"a squirrel cozy in a hollow tree watching autumn rain, "
230
- f"acorn collection visible inside, warm golden glow, {STYLE}"),
231
- ("autumn_10", f"a bunny and a baby fox under a giant colorful umbrella in a rainy autumn street, "
232
- f"cafΓ© lights, reflections in puddles, {STYLE}"),
233
  ]
234
 
235
- assert len(PROMPTS) == 80, f"Expected 80 prompts, got {len(PROMPTS)}"
 
 
 
 
 
 
 
 
 
 
 
236
 
237
  # ---------------------------------------------------------------------------
238
- # Generator using FLUX.1-dev via HuggingFace Inference API
239
  # ---------------------------------------------------------------------------
240
 
241
  # Provider β†’ model routing:
242
- # fal-ai β†’ FLUX.1-dev (best quality, free credits at fal.ai)
243
- # hf-inference β†’ FLUX.1-schnell (HF free tier, lower quality)
244
  PROVIDERS = {
245
- "fal-ai": "black-forest-labs/FLUX.1-dev",
246
  "hf-inference": "black-forest-labs/FLUX.1-schnell",
247
  }
248
 
 
1
  """
2
  NumZoo training dataset generator.
3
 
4
+ Generates LoRA training images matching the NumZoo aesthetic using FLUX.2-dev
5
+ via the HuggingFace Inference API (fal-ai provider, billed to your HF Pro credits).
6
 
7
+ Alignment with the live app is guaranteed by construction:
8
+ - The "A cute {animals} {places}" prefix is built with image_generator.build_subject
9
+ (the SAME function the app uses), from the app's exact ANIMAL_MAP / PLACE_MAP.
10
+ - The NUMZOO_STYLE suffix is imported from image_generator.
11
+ - Scenes deliberately mix 1–3 animals and 1–3 places, exactly like the app does
12
+ when the player selects multiple emojis.
13
+ So every caption looks like a real app prompt, plus a rich scene detail clause.
14
 
15
  Output: training/image_001.jpg + training/image_001.txt (caption)
16
 
17
  Requirements:
18
+ ~/miniforge3/bin/pip install huggingface_hub pillow python-dotenv
19
 
20
  Setup (HF Pro β€” just your existing token):
21
+ 1. Accept the FLUX.2-dev license: https://huggingface.co/black-forest-labs/FLUX.2-dev
22
+ 2. Get an HF token (fine-grained, "Make calls to Inference Providers" permission)
23
+ https://huggingface.co/settings/tokens
24
+ 3. Add to .env: HF_TOKEN=hf_...
 
 
 
25
 
26
  Usage:
27
+ ~/miniforge3/bin/python3 scripts/generate_dataset.py # all scenes
28
+ ~/miniforge3/bin/python3 scripts/generate_dataset.py --count 5 # first 5 (test run)
29
+ ~/miniforge3/bin/python3 scripts/generate_dataset.py --start 20 # resume from #20
30
+ ~/miniforge3/bin/python3 scripts/generate_dataset.py --dry-run # preview prompts
31
  """
32
 
33
  import os
 
43
  except ImportError:
44
  pass # dotenv optional β€” can also export GEMINI_API_KEY manually
45
 
46
+ # Reuse the app's exact prompt builder + vocabulary so training captions and live
47
+ # prompts share the same structure ("A cute {animals} {places}") and emoji mappings.
48
  sys.path.insert(0, str(Path(__file__).parent.parent))
49
+ from image_generator import ( # noqa: E402
50
+ build_subject,
51
+ NUMZOO_STYLE as STYLE,
52
+ ANIMAL_MAP,
53
+ PLACE_MAP,
54
+ )
55
 
56
  # ---------------------------------------------------------------------------
57
+ # Scenes: (animal emojis, place emojis, scene-detail clause)
58
+ # Animals/places use the app's exact emoji keys. The "A cute {animals} {places}"
59
+ # prefix is built by image_generator.build_subject; the detail adds rich props,
60
+ # activity and lighting for the cozy aesthetic. Deliberately mixes 1–3 animals
61
+ # and 1–3 places to mirror multi-emoji selections in the app.
62
  # ---------------------------------------------------------------------------
63
 
64
+ SCENES: list[tuple[list[str], list[str], str]] = [
65
+ # ── Solo animal, single place β€” covers all 12 animals + all 10 places ──
66
+ (["🐰"], ["πŸ„"], "sitting on a polka-dot toadstool, fireflies and floating spores drifting around, soft lantern glow"),
67
+ (["🐱"], ["🌊"], "building a tiny sandcastle with a bucket and shells, gentle waves lapping, warm sunset sky"),
68
+ (["🐢"], ["🏑"], "napping in a flower-filled wheelbarrow, watering can and butterflies nearby, golden afternoon light"),
69
+ (["🦊"], ["⭐"], "curled up on a fluffy cloud cradling a tiny glowing star, glittering night sky"),
70
+ (["🐼"], ["🌸"], "nibbling a dango skewer as petals fall, paper lanterns strung above, soft pink light"),
71
+ (["🐨"], ["🌴"], "hugging a palm trunk with a coconut drink, striped hammock and a parrot, turquoise sea behind"),
72
+ (["🦁"], ["🌈"], "wearing a tiny crown at the end of a rainbow, pastel clouds and floating sparkles"),
73
+ (["🐯"], ["πŸ”οΈ"], "bundled in a knitted scarf on a snowy peak planting a tiny flag, sparkling snow and faint aurora"),
74
+ (["🐸"], ["🌺"], "perched on a giant hibiscus bloom, dewdrops glistening, big tropical leaves and warm bokeh"),
75
+ (["🐧"], ["πŸŒ™"], "sitting on the curve of a glowing crescent moon in a knitted hat, scattered twinkling stars"),
76
+ (["πŸ¦‹"], ["🌸"], "fluttering through cherry blossoms trailing sparkles, pastel petals swirling in the breeze"),
77
+ (["πŸ¦„"], ["⭐"], "galloping across a starry sky, rainbow mane glowing, a trail of sparkles behind"),
78
+ (["🐢"], ["πŸ„"], "exploring beneath a giant mushroom with a tiny lantern, glowing toadstools and soft moss"),
79
+ (["🐱"], ["πŸŒ™"], "curled asleep on a crescent moon wearing a nightcap, twinkling stars all around"),
80
+ (["🐰"], ["🌊"], "splashing in shallow waves beside a starfish friend, beach pail and spade, pink sunset"),
81
+ (["🐼"], ["🏑"], "tending a vegetable patch in a straw hat, bees and tall sunflowers, warm sun"),
82
+ (["🐧"], ["πŸ”οΈ"], "sliding down a snowy slope on its belly, scarf flying, sparkling powder snow"),
83
+ (["🦊"], ["🌴"], "lounging in a hammock between two palms with sunglasses, coconuts and calm ocean"),
84
+ (["🦁"], ["🌺"], "snoozing in a field of tropical flowers, a butterfly on its nose, dappled golden light"),
85
+ (["🐯"], ["🌸"], "chasing falling cherry petals, paper lanterns above, soft pink and lilac tones"),
86
+ (["🐸"], ["πŸ„"], "playing a tiny flute on a lily pad among glowing mushrooms, fireflies and reeds"),
87
+ (["πŸ¦„"], ["🌈"], "standing proudly under a rainbow, flower garland around its neck, pastel clouds"),
88
+
89
+ # ── Two animals, single place ──
90
+ (["🐰", "🐱"], ["πŸ„"], "roasting marshmallows over a tiny campfire, fireflies and glowing mushrooms, cozy night"),
91
+ (["🐢", "🦊"], ["🌊"], "building a sandcastle together with shell flags, gentle waves at golden hour"),
92
+ (["🐼", "🐨"], ["🌸"], "sharing tea under a blooming cherry tree, paper lanterns, drifting petals"),
93
+ (["🦁", "🐯"], ["🏑"], "tumbling over a ball of yarn in a cottage garden, picket fence and butterflies"),
94
+ (["🐧", "🐰"], ["πŸ”οΈ"], "ice skating on a frozen pond atop a snowy mountain, fairy lights, gentle snowfall"),
95
+ (["🐸", "πŸ¦‹"], ["🌺"], "resting together on lily pads among tropical flowers, dragonflies and warm bokeh"),
96
+ (["🐱", "🐢"], ["πŸŒ™"], "stargazing from a crescent moon with a tiny brass telescope, soft constellations"),
97
+ (["πŸ¦„", "🐰"], ["🌈"], "trotting side by side under a rainbow, flower garlands and floating sparkles"),
98
+ (["🦊", "🐼"], ["πŸ„"], "reading a glowing storybook under a toadstool, a lantern and curious fireflies"),
99
+ (["🐨", "🐧"], ["🌴"], "sipping coconut drinks on a tropical island, beach umbrella and gentle surf"),
100
+ (["🐰", "πŸ¦„"], ["⭐"], "swinging on a swing hung from the stars, sparkles raining down, deep blue night"),
101
+ (["🐱", "🐸"], ["🌊"], "collecting shells in tide pools at low tide, a little net and a pastel sunset"),
102
+
103
+ # ── Three animals, single place ──
104
+ (["🐰", "🐱", "🐢"], ["πŸ„"], "having a picnic on a checkered blanket among glowing mushrooms, lanterns and fireflies"),
105
+ (["🦊", "🐼", "🐨"], ["🌸"], "a tea party under cherry blossoms with tiny cups, paper lanterns and drifting petals"),
106
+ (["🦁", "🐯", "🐸"], ["🏑"], "playing tag through flower beds in a cottage garden, butterflies and warm sun"),
107
+ (["🐧", "🐰", "🐱"], ["πŸ”οΈ"], "building a snowman on a snowy peak in matching scarves, sparkling snow, aurora above"),
108
+ (["πŸ¦„", "πŸ¦‹", "🐰"], ["🌈"], "dancing under a rainbow amid sparkles and flower petals, pastel sky"),
109
+ (["🐢", "🦊", "🐼"], ["🌊"], "surfing tiny waves together with a beach ball, palm trees and sunset glow"),
110
+ (["🐱", "🐨", "🐸"], ["🌺"], "weaving flower crowns in a field of tropical flowers, butterflies and golden bokeh"),
111
+ (["🦁", "🐯", "🐰"], ["⭐"], "huddled on a cloud counting sparkling stars under a shared blanket, soft glow"),
112
+
113
+ # ── Two places ──
114
+ (["🐰"], ["πŸ„", "🌈"], "hopping from a mushroom grove toward a rainbow, sparkles bridging the two, pastel light"),
115
+ (["🐱", "🐢"], ["🌊", "🌴"], "a beach day between ocean waves and a tropical island, palm shade and scattered shells"),
116
+ (["πŸ¦„"], ["⭐", "πŸŒ™"], "soaring past sparkling stars toward a crescent moon, a glowing rainbow trail"),
117
+ (["🐼"], ["🌸", "🏑"], "wandering from cherry blossoms into a cosy cottage garden, petals and busy bees"),
118
+ (["🐧", "🐰"], ["πŸ”οΈ", "⭐"], "watching sparkling stars from a snowy mountain top, fairy lights and soft snow"),
119
+ (["🦊"], ["🌺", "🌴"], "exploring tropical flowers along a tropical island shore, parrots and warm bokeh"),
120
+ (["🐸", "πŸ¦‹"], ["🌸", "🌺"], "drifting between cherry blossoms and tropical flowers, dewdrops and floating petals"),
121
+ (["🦁"], ["🏑", "🌈"], "lazing in a cottage garden as a rainbow arcs overhead, butterflies and golden light"),
122
+
123
+ # ── Three places ──
124
+ (["🐰", "🐱"], ["πŸ„", "🌈", "⭐"], "a dreamy journey through a mushroom forest, under a rainbow and beneath sparkling stars, a glowing trail"),
125
+ (["πŸ¦„"], ["πŸŒ™", "⭐", "🌈"], "flying past a crescent moon and sparkling stars toward a rainbow, sparkles everywhere"),
126
+ (["🐢", "🦊", "🐼"], ["🌊", "🌴", "🌺"], "a tropical adventure across a sunny beach, a tropical island and fields of flowers, parrots and surf"),
127
+ (["🐧", "🐰", "🐱"], ["πŸ”οΈ", "⭐", "πŸŒ™"], "a starry night on a snowy peak under a crescent moon and sparkling stars, fairy lights and aurora"),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  ]
129
 
130
+
131
+ def _scene_name(idx: int, animals: list[str], places: list[str]) -> str:
132
+ """Short readable label for logs, e.g. '03_panda_1a1p'."""
133
+ first = ANIMAL_MAP[animals[0]].replace("baby ", "")
134
+ return f"{idx:02d}_{first}_{len(animals)}a{len(places)}p"
135
+
136
+
137
+ # Build (name, full_prompt) using the SAME prefix builder + STYLE suffix as the app.
138
+ PROMPTS: list[tuple[str, str]] = [
139
+ (_scene_name(i + 1, a, p), f"{build_subject(a, p)}, {detail}, {STYLE}")
140
+ for i, (a, p, detail) in enumerate(SCENES)
141
+ ]
142
 
143
  # ---------------------------------------------------------------------------
144
+ # Generator using FLUX.2-dev via HuggingFace Inference API
145
  # ---------------------------------------------------------------------------
146
 
147
  # Provider β†’ model routing:
148
+ # fal-ai β†’ FLUX.2-dev (best quality; billed to HF Pro credits)
149
+ # hf-inference β†’ FLUX.1-schnell (HF native fallback, lower quality)
150
  PROVIDERS = {
151
+ "fal-ai": "black-forest-labs/FLUX.2-dev",
152
  "hf-inference": "black-forest-labs/FLUX.1-schnell",
153
  }
154