Skip to content

Instantly share code, notes, and snippets.

@rndmcnlly
Created March 4, 2025 01:50
Show Gist options
  • Save rndmcnlly/310213bf15a29c9a3fb753972d032abb to your computer and use it in GitHub Desktop.
Save rndmcnlly/310213bf15a29c9a3fb753972d032abb to your computer and use it in GitHub Desktop.
nested image description prompt expander thingy
You are tasked with expanding image prompt templates containing nested expressions in braces {}. Your job is to iteratively identify and expand the innermost braced expression until no braced expressions remain.
PROCESS:
1. Identify the innermost braced expression {X}
2. Replace that expression with a specific, creative expansion
3. Show the new state of the prompt
4. Repeat steps 1-3 until no braced expressions remain
5. Output the final, fully expanded prompt
Use <original>, <step>, and <final> XML tags to clearly mark each stage of the expansion process.
EXAMPLE:
<original>A man fighting {the opposite of {some 90's cartoon character}}</original>
<step>
Innermost expression: {some 90's cartoon character}
Expansion: a Teenage Mutant Ninja Turtle
Result: A man fighting {the opposite of a Teenage Mutant Ninja Turtle}
</step>
<step>
Innermost expression: {the opposite of a Teenage Mutant Ninja Turtle}
Expansion: a timid elderly accountant
Result: A man fighting a timid elderly accountant
</step>
<final>A man fighting a timid elderly accountant</final>
Now expand the following prompt template:
<original>
[PROMPT WITH NESTED BRACES GOES HERE]
</original>
# Prompt Expansion Process
<original>
A {very {strange color}} dinosaur wearing {formal attire from {a historical period when {popular music genre} was at its peak}} while {activity you might do on {a type of extreme weather} day} in the middle of {setting from {a children's book published before 1950}}
</original>
<step>
Innermost expression: {strange color}
Expansion: opalescent chartreuse
Result: A {very opalescent chartreuse} dinosaur wearing {formal attire from {a historical period when {popular music genre} was at its peak}} while {activity you might do on {a type of extreme weather} day} in the middle of {setting from {a children's book published before 1950}}
</step>
<step>
Innermost expression: {very opalescent chartreuse}
Expansion: blindingly iridescent lime-green with purple undertones
Result: A blindingly iridescent lime-green with purple undertones dinosaur wearing {formal attire from {a historical period when {popular music genre} was at its peak}} while {activity you might do on {a type of extreme weather} day} in the middle of {setting from {a children's book published before 1950}}
</step>
<step>
Innermost expression: {popular music genre}
Expansion: disco
Result: A blindingly iridescent lime-green with purple undertones dinosaur wearing {formal attire from {a historical period when disco was at its peak}} while {activity you might do on {a type of extreme weather} day} in the middle of {setting from {a children's book published before 1950}}
</step>
<step>
Innermost expression: {a historical period when disco was at its peak}
Expansion: the glamorous 1970s
Result: A blindingly iridescent lime-green with purple undertones dinosaur wearing {formal attire from the glamorous 1970s} while {activity you might do on {a type of extreme weather} day} in the middle of {setting from {a children's book published before 1950}}
</step>
<step>
Innermost expression: {formal attire from the glamorous 1970s}
Expansion: a white three-piece bell-bottomed suit with wide lapels and platform shoes
Result: A blindingly iridescent lime-green with purple undertones dinosaur wearing a white three-piece bell-bottomed suit with wide lapels and platform shoes while {activity you might do on {a type of extreme weather} day} in the middle of {setting from {a children's book published before 1950}}
</step>
<step>
Innermost expression: {a type of extreme weather}
Expansion: blizzard
Result: A blindingly iridescent lime-green with purple undertones dinosaur wearing a white three-piece bell-bottomed suit with wide lapels and platform shoes while {activity you might do on blizzard day} in the middle of {setting from {a children's book published before 1950}}
</step>
<step>
Innermost expression: {activity you might do on blizzard day}
Expansion: building an elaborate snow fortress with turrets and a drawbridge
Result: A blindingly iridescent lime-green with purple undertones dinosaur wearing a white three-piece bell-bottomed suit with wide lapels and platform shoes while building an elaborate snow fortress with turrets and a drawbridge in the middle of {setting from {a children's book published before 1950}}
</step>
<step>
Innermost expression: {a children's book published before 1950}
Expansion: Winnie-the-Pooh
Result: A blindingly iridescent lime-green with purple undertones dinosaur wearing a white three-piece bell-bottomed suit with wide lapels and platform shoes while building an elaborate snow fortress with turrets and a drawbridge in the middle of {setting from Winnie-the-Pooh}
</step>
<step>
Innermost expression: {setting from Winnie-the-Pooh}
Expansion: the Hundred Acre Wood with its honey trees and wooden bridges
Result: A blindingly iridescent lime-green with purple undertones dinosaur wearing a white three-piece bell-bottomed suit with wide lapels and platform shoes while building an elaborate snow fortress with turrets and a drawbridge in the middle of the Hundred Acre Wood with its honey trees and wooden bridges
</step>
<final>A blindingly iridescent lime-green with purple undertones dinosaur wearing a white three-piece bell-bottomed suit with wide lapels and platform shoes while building an elaborate snow fortress with turrets and a drawbridge in the middle of the Hundred Acre Wood with its honey trees and wooden bridges</final>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment