Dynamic Prompting

I'd like to find Dynamic Prompting as a standard "plus" in the prompt section. Dynamic prompting is a technique that randomly choose one word within a set of words within {a|b|c} brackets.

The most obvious use is to create a field of things for experiment, like "a { house | tree | castle | giant } in a ghibli universe", to text hundreds or artists names, or combine vocabulary (you make a scene with a seed, and you add { night | day | rain | twilight | mist}.

I implement it in all my colabs, with a function:

def generate_dynamic_prompt(prompt):
while "{" in prompt and "}" in prompt:
start = prompt.index("{")
end = prompt.index("}")
options_str = prompt[start + 1:end]
options = options_str.split("|")
choice = random.choice(options).strip()
prompt = prompt[:start] + choice + prompt[end + 1:]
return prompt

Example of prompt:

A {surreal|unearthly|fantastical|phantasmagoric|dreamlike|hypnotic|bizarre|absurd|odd|otherworldly} {eye|iris|optic|eyeball|peeper|oculus|visionary globe|ocular organ|staring orb|visionary disc}, with {steampunk artifacts|crystalline butterfly wings|wrought iron details|interlaced electronic circuits|carved wooden filigree|glass tear drops|spider silk|feather tufts|polished gemstones|light-refracting prisms} {vibrant|subdued|monochrome|pastel|hued|sepia|black and white|jewel-toned|color blocked|iridescent}, by {Banksy|Warhol|Basquiat|Haring|Picasso|Matisse|van Gogh|Monet|Degas|Pollock}'s style. {dappled sunlight|moonlit glow|candlelight|neon brightness|fluorescent gleam|twilight haze|sunrise radiance|sunset hues|lantern luminescence|starlight glimmer} {Harper's Bazaar|Vogue|National Geographic|Rolling Stone|Time|The New Yorker|Elle|GQ|Vanity Fair}

Please authenticate to join the conversation.

Upvoters
Status

In Review

Board

πŸ’‘ Feature Request

Date

Almost 2 years ago

Author

Nick Shykula

Subscribe to post

Get notified by email when there are changes.