goumsss Claude Opus 4.8 commited on
Commit
01c4239
·
1 Parent(s): aa5f2e5

Prompt: repeat "a cute" per animal for clearer multi-animal scenes

Browse files

Split _join into _join_animals / _join_places. Animals now read
"puppy, a cute kitten and a cute bunny" so the model renders each as a
distinct cute subject (helps 2–3 animal rewards).

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

Files changed (1) hide show
  1. image_generator.py +13 -3
image_generator.py CHANGED
@@ -210,7 +210,17 @@ NUMZOO_STYLE = (
210
  # Prompt builder
211
  # ---------------------------------------------------------------------------
212
 
213
- def _join(parts: list[str]) -> str:
 
 
 
 
 
 
 
 
 
 
214
  """Join 1–3 phrases: 'a', 'a and b', 'a, b and c'."""
215
  if len(parts) == 1:
216
  return parts[0]
@@ -224,8 +234,8 @@ def build_subject(animals: list[str], places: list[str]) -> str:
224
  so training captions and live prompts use the exact same structure & vocabulary."""
225
  animal_list = animals[:3] if animals else [random.choice(list(ANIMAL_MAP))]
226
  place_list = places[:3] if places else [random.choice(list(PLACE_MAP))]
227
- animal_text = _join([ANIMAL_MAP.get(a, "bunny") for a in animal_list])
228
- place_text = _join([PLACE_MAP.get(p, "in a magical garden") for p in place_list])
229
  return f"A cute {animal_text} {place_text}"
230
 
231
 
 
210
  # Prompt builder
211
  # ---------------------------------------------------------------------------
212
 
213
+
214
+ def _join_animals(parts: list[str]) -> str:
215
+ """Join 1–3 phrases: 'a', 'a and b', 'a, b and c'."""
216
+ if len(parts) == 1:
217
+ return parts[0]
218
+ if len(parts) == 2:
219
+ return f"{parts[0]} and a cute {parts[1]}"
220
+ return f"{parts[0]}, a cute {parts[1]} and a cute {parts[2]}"
221
+
222
+
223
+ def _join_places(parts: list[str]) -> str:
224
  """Join 1–3 phrases: 'a', 'a and b', 'a, b and c'."""
225
  if len(parts) == 1:
226
  return parts[0]
 
234
  so training captions and live prompts use the exact same structure & vocabulary."""
235
  animal_list = animals[:3] if animals else [random.choice(list(ANIMAL_MAP))]
236
  place_list = places[:3] if places else [random.choice(list(PLACE_MAP))]
237
+ animal_text = _join_animals([ANIMAL_MAP.get(a, "bunny") for a in animal_list])
238
+ place_text = _join_places([PLACE_MAP.get(p, "in a magical garden") for p in place_list])
239
  return f"A cute {animal_text} {place_text}"
240
 
241