Created
January 4, 2022 08:50
-
-
Save drusepth/7b681531136ae51aac6fa94965e9156e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
] | |
color = [ | |
'black', 'silver', 'gray', 'grey', 'green', 'blue', 'indigo', 'orange', 'red', | |
'yellow', 'violet', 'purple', 'black', 'white', 'rainbow', 'chromatic', 'silver' | |
] # 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', | |
'babbon', 'eagle', 'bat', 'bee', 'spirit', 'ghost', 'apparition', 'ant', 'pig', | |
'horse', 'cow', 'ram', 'bull', 'preying mantis', 'grasshopper' | |
] | |
pose = [ | |
'lying down', 'sitting down', 'sitting up', 'standing up', 'sleeping', | |
'hunting', 'attacking', 'watching' | |
] | |
location = [ | |
'', 'in a cave', 'in a field', 'in a forest', 'in enchanted forest', | |
'in a desert', 'in snowy tundra', 'on mountainside', 'on mountain' | |
] | |
artist = [ | |
'Bob Ross' | |
] | |
suffix = [ | |
'MTG art', 'WoW art', 'trending on ArtStation', 'Unreal engine', 'photograph', | |
'fan art', 'sketch', 'comission', 'classic art' | |
] | |
templates = [ | |
# "<adjective> <animal>", | |
# "<adjective> <color> <animal>", | |
"<adjective> <color> <animal> <pose> <location> (<suffix> <suffix>)", | |
"<adjective> <animal> <location>, by <artist> (<suffix>)", | |
"<adjective> <color> <animal> <pose>, by <artist>", | |
"<adjective> <color> <animal> <pose>, by <artist>", | |
"<adjective> <animal> <location>, by <artist> (<suffix>)", | |
"<adjective> <color> <animal> <location>, by <artist> (<suffix>)", | |
"<adjective> <color> <animal> <pose> <location>, by <artist> (<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 | |
for lol in range(10): | |
print(generate_new_prompt()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment