Skip to content

Instantly share code, notes, and snippets.

@drusepth
Created March 24, 2022 08:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drusepth/c7d002c6f6c4e928fe11f5fbe79aeafa to your computer and use it in GitHub Desktop.
Save drusepth/c7d002c6f6c4e928fe11f5fbe79aeafa to your computer and use it in GitHub Desktop.
import random
import re
#@title Prompt Settings
adjective = [
'Fierce', 'Scary', 'Interesting', 'Novel', 'Furry', 'Long-haired', 'Short-haired',
'Electric', 'Plasma', 'Humanoid', 'Insectoid', 'Alien', 'Tundra', 'Siberian', 'Ancient',
'Gigantic', 'Tiny', 'Small', 'Large', 'Oversized', 'Wild', 'Shadowy', 'Evil', 'Angelic',
'Good', 'Holy', 'Crystalline', 'Impressive', 'Cute', 'Kawaii', 'Celestial', 'Chibi',
'Anime', 'Manga', 'Live-action', 'Japanese', 'Western', 'Eastern', 'Zombified', 'Immortal',
'Undead', 'Pokemon', 'Skeletal', 'Comforting', 'Religious', 'Fiery', 'Hellish', 'Frenzied',
'Psychedelic'
]
color = [
'black', 'silver', 'gray', 'grey', 'green', 'blue', 'indigo', 'orange', 'red',
'yellow', 'violet', 'purple', 'black', 'white', 'rainbow', 'chromatic', 'silver',
'shadow', 'golden', 'gold', 'maroon', 'teal', 'transparent', 'see-through',
'amber', 'fushsia', 'auburn', 'beige', 'brown', 'navy blue', 'rosy', 'bronze',
'burgundy', 'sienna', 'umber', 'caramel', 'cerulean', 'colorful', 'charcoal',
'chrome', 'copper', 'citrine', 'coral', 'crimson', 'cyan', 'goldenrod', 'magenta',
'turquoise', 'ebony', 'ivory', 'colorless', 'black and white', 'mauve',
'dark <color>', 'light <color>', '<color>ish <color>',
'neon <color>'
] # todo: also allow tokens in prompt like [colors-random] to insert a random color
animal = [
'lion', 'tiger', 'bear', 'aardvark', 'bird', 'worm', 'dragon', 'deer', 'moose',
'cat', 'dog', 'mouse', 'sloth', 'fox', 'giraffe', 'werewolf', 'snake', 'dragon',
'wyvern', 'wyrm', 'drake', 'goat', 'sheep', 'fish', 'dolphin', 'whale', 'rabbit',
'bunny', 'hare', 'leopard', 'toad', 'frog', 'tortoise', 'turtle', 'insect', 'spider',
'arachnid', 'armadillo', 'axolotl', 'wolf', 'scale worm', 'badger', 'owl',
'baboon', 'eagle', 'bat', 'bee', 'spirit', 'ghost', 'apparition', 'ant', 'pig',
'horse', 'cow', 'ram', 'bull', 'preying mantis', 'grasshopper', 'pangolier', 'lich',
'butterfly', 'moth', 'elemental', 'lifeforce', 'crab', 'dolphin', 'phoenix',
'demon', 'imp', 'devil', 'ent', 'living tree', 'gryphon', 'chimera', 'snail',
'crow', 'raven', 'labrador', 'poodle', 'cheetah', 'jaguar', 'jellyfish', 'unicorn',
'pegasus', 'lamb', 'fawn', 'elephant', 'squid', 'octopus', 'slug', 'eel',
'<animal>-<animal> hybrid', 'sea-<animal>'
]
pose = [
'lying down', 'sitting down', 'sitting up', 'standing up', 'sleeping',
'hunting', 'attacking', 'watching', 'staring', 'defending', 'hiding',
'eating', 'running', 'walking', 'jumping', 'waiting', 'posing'
]
location = [
'', 'in a cave', 'in a field', 'in a forest', 'in enchanted forest',
'in a desert', 'in snowy tundra', 'on mountainside', 'on mountain', 'in tundra',
'in blizzard', 'in clouds', 'in field', 'in plains', 'in valley', 'on hill',
'in street', 'in zoo', 'on Mars', 'in cave'
]
artist = [
'Mark Rosewater', 'Vincent van Gogh', 'Russell Brower', 'Derek Duke', 'Matt Uelmen',
'Adam Zivojnovich', 'Glenn Stafford', 'Adam Sapphire', 'Scott Johnson', 'Terese Nielsen',
'Rebecca Guay', 'Greg Staples', 'Mark Tedin', 'Matt Cavotta', 'John Avon', 'Steve Argyle',
'Kev Walker', 'Ron Spencer', 'Bob Ross', 'Alex Horley', 'Scott Fischer', 'Michael Komarck',
'Christopher Rush', 'Aleksi Briclot', 'Carl Critchlow', 'Donato Giancola', 'Junji Ito',
'Kaja Foglio', 'Noah Bradley', 'Joel Sartore', 'Steve McCurry', 'Jimmy Chin',
'Stephanie Sinclair', 'Lynn Johnson', 'Brian Skerry', 'Jodi Cobb', 'Erika Larsen',
'Amy Toensing', 'Frans Lanting', 'David Guttenfelder', 'Chris Johns', 'Tim Laman',
'Sisse Brimberg', 'Ira Block', 'Louie Palu', 'Cotton Coulson'
]
suffix = [
'MTG art', 'WoW art', 'trending on ArtStation', 'Unreal engine', 'photograph',
'fan art', 'sketch', 'comission', 'classic art', 'realistic', 'hyper-realistic',
'ultra-realistic', 'photo', 'trending on Instagram'
]
templates = [
"<adjective> <animal>",
"<adjective> <color> <animal>",
"<adjective> <color> <animal> <pose> <location> (<suffix> <suffix>)",
"<adjective> <animal> <location>, in the style of <artist> (<suffix>)",
"<adjective> <color> <animal> <pose>, in the style of <artist>",
"<adjective> <color> <animal> <pose>, in the style of <artist>",
"<adjective> <animal> <location>, in the style of <artist> (<suffix>)",
"<adjective> <color> <animal> <location>, in the style of <artist> (<suffix>)",
"<adjective> <color> <animal> <pose> <location>, in the style of <artist> (<suffix>)",
"<adjective> <color> <animal> <pose> <location> (<suffix> <suffix>)",
"<adjective> <animal> <location> (<suffix>)",
"<adjective> <color> <animal> <pose>",
"<adjective> <color> <animal> <pose>",
"<adjective> <animal> <location> (<suffix>)",
"<adjective> <color> <animal> <location> (<suffix>)",
"<adjective> <color> <animal> <pose> <location> (<suffix>)"
]
def generate_new_prompt():
template = random.sample(templates, 1)[0]
token_pattern = re.compile(r'<([a-zA-Z]+)>')
for (token_to_replace) in re.findall(token_pattern, template):
while ('<' + token_to_replace + '>') in template:
replacement = random.sample(eval(token_to_replace), 1)[0]
template = re.sub('<' + token_to_replace + '>', replacement, template, 1)
return template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment