-
Notifications
You must be signed in to change notification settings - Fork 0
/
FantasyGenesis_Midjourney.py
329 lines (285 loc) · 10.4 KB
/
FantasyGenesis_Midjourney.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# A Fantasy Genesis Nested Lists
# The Lists:
# Anima
Anim_1_Sea_Life = ["Mollusk",
"Crab, Lobster",
"Squid, Mudskipper",
["Fish: Deep sea", "Fish: Fresh water"],
"Jellyfish",
[["Whale", "Killer Whale", "Narwhale"], "Dolphin", "Walrus", "Otter"],
["Shell: spiral", "Conch", "Shell: ribbed, clam"],
"Eel, Leech, Hagfish",
"Coral, Anemone",
"Shark, ray"]
Anim_2_Insect = ["Worm",
"Ant",
"Mosquito",
"Moth, Butterfly",
"Fly, dragonfly",
"Lotus, Mantis",
"Bee, Wasp",
"Caterpillar, Centipede, Milipede",
"Beetle, Scarab",
"Flea, Mite",
"Spider"]
Anim_3_Mammal = ["Sheep, cow",
"Mouse, Rabbit",
"Pig, Boar",
"Deer, Pronghorn",
"Ram, Bull, Buck",
"Elephant, Giraffe",
"Bat",
"Bear",
"Lupine: Wild Dog",
"Horse, Zeebra",
"Feline: Wild Cat",
"Primate"]
Anim_4_Reptile = ["Crocodile, Gila",
"Frog, Newt",
["Lizard", "Chameleon", "Gecko", "Iguana", "Frilled Lizard"],
["Snake", "Cobra", "Python", "Rattlesnake"],
["Turtle", "Box Turtle", "Sea Turtle"]]
Anim_5_Bird = ["Wild Fowl, Duck, Goose",
"Farm Fowl, Rooster",
"Seabird, Penguin, Gull",
"City bird: Raven, Sparrow",
"Tropical bird: Parrot, Heron",
"Bird of Prey: Hawk, Owl",
"Hummingbird"]
# Veggie
Vegi_1_Plant = ["Seaweed",
"Fern",
"Desert Cacti",
"Thick Leaf Plant, Jade",
"Flower: Domestic",
"Vine",
"Poppy",
"Grass, Dandelion",
"Bamboo",
"Flower: Wild",
"Carnivorous Plant"]
Vegi_2_Fruit_Vegi = ["Asparagus",
"Pinecone",
"Berry, Grapes",
"Ginger",
"Tree fruit (apple, orange)",
"Bean",
"Pumpkin, Gourd",
"Broccoli, Artichoke",
"Corn",
"Grain, Wheat",
"Pineapple"]
Vegi_3_Fungi = ["Moss",
"Slime Fungi: Ooze, Jelly",
["Lichen", "Lichen: Crustose", "Lichen: Foliose", "Lichen: Fruticose"],
["Mushroom: Cap and Stem", "Fungus: Bracket or Shelf", "Fungus: Puffball", "Coral Fungus", "Stinkhorn fungus"]]
Vegi_4_Tree = ["Willow",
"Birch",
"Maple, Oak",
"Banyan",
"Pine",
"Palm"]
# Elemental & Mineral
Elem_1_Fire_Electric = [["Fire: campfire", "Fire: candle flame", "Fire: forest fire"],
"Steam: Vapor or mist",
["Forked Lightning", "Sheet Lightning"],
"Glowing Ember, Hot Coal",
["Flowing Molten Lava", "Lava Fountain"]]
Elem_2_Liquid = ["Icicles",
"Fog, Vapor",
"Wave",
"Dew Drops",
"Ripple",
"Frost, Snow",
"Suds, Bubbles",
"Tar, Gum"]
Elem_3_Earth_Metal = ["Malachite",
"Mountain, Cliff Face",
"Brick, Cobblestone",
"Rust, Oxide",
"Cracked Clay",
"Stalactite, Stalagmite",
"Glass, Crystals",
"Powder, Sand",
"Slate, Shale",
"Cement, Sediment",
"Mercury, Chrome"]
Elem_4_Astral_Atmosphere = [["Full Moon", "Crescent Moon", "Gibbous Moon"],
["Starfield: Constellations", "Starfield: Milky Way"],
"Crater, Asteroid",
"Solar Flare: Plasma Loops",
"Galaxy form, spiral or elliptical",
"Volcano: Ash Plume",
["Planets, Saturn's Rings","Planets, Jupiter's Great Red Spot"],
["Clouds", "Cyclone", "Turbulence"]]
#Technical
Tech_1_Transportation = ["Car, Truck, Bus",
"Aircraft",
"Rail, Train, Trolley",
"MotorCycle BiCycle",
"Sled, Ski",
"Boat, Ship",
"Spacecraft",
"Tank, Caterpillar Tread"]
Tech_2_Architecture = [["Ornament, Gargoyle", "Ornament, Pillar"],
"Bridge, Framework",
"Castle, Dome",
"Modern Skyscraper",
["Place of Worship", "Totem", "Cathedral", "Temple"],
["Doorway, Archway", "Window"],
"Old Village, Cottage",
"Tent"]
Tech_3_Tool = ["Drill",
["Cup", "Bowl", "Plate", "Silverware"],
"Umbrella",
"Bundle, Bale",
"Hammer, Axe",
"Brush: Hair, Tooth",
"Razor, Knife",
"Spigot, Faucet",
"Rope",
"Lock, Key",
"Adhesive, Bandage",
"Shovel, Pick",
"Capsule, Tablet",
"Nuts, Bolts",
"Chain",
"Thread, Stitch",
"Shears, Scissors",
"Pen, Paintbrush",
"Spring, Coil",
"Syringe",
"Tube, Plumbing",
"Wrench, Pliers"]
Tech_4_Machine = [["Switch", "Dial, Knob", "Button", "Lever", "Foot Pedal"],
["Bulb, Lamp", "Arc lamp", "Spotlight"],
["Clock, Gears", "Piston, Cylinder"],
["Mechanical Saw","Laser Beam"],
["Reactor Core", "Engine", "Solar Panel"],
"Telephone",
["Microchip", "Circuit Board", "Network Room, Cables"],
"Dish Antenna",
["Rocket", "Turbine", "Fan, Propeller"]]
#Character Elements
Emotions = ["Embarrassed",
"Anger",
"Timid, Bashfull",
"Giggle, Smiling",
"Squint, Wink",
"Bored",
"Stressed, Fatigued",
"Fear",
"Thought, Meditation",
"Deadpan",
"Insane, Berserker",
"Insane, Happy",
"Pining, Furrowed",
"Laughing, Hysterical",
"Attentive, Shock",
"Stern, Grumpy",
"Clenched Teeth",
"Gape, Gawk",
"Relief",
"Sneering",
"Paranoid, Shifty",
"Bliss, Joy",
"Confusion"]
Actions = ["Recoil, Akimbo",
"Drenched, Thirst",
"Blown by Cyclone",
"Push, Pull",
"Snoop, Listen",
"Crouched for Attack",
"Hang, Climb",
"Recoil, Head/Torso",
"Float, Levitate",
"Swinging Weapon",
"Twisting, Stretching",
"Kicking, Punching",
"Squeeze, Tackle",
"Absorb, Eat",
"Limp, Injured",
"Curse, Swear",
"Run, Jump",
"Melt, Glow, Fire",
"Stuck, Trapped",
"Pull, Push",
"Shoot Weapon",
"Dying, Gaunt",
"Fly, Swim",
"Shed, Molting",
"Chant, Recite",
"Crawl, Emerge"]
# Compliations of the different Sets
Anima = [Anim_1_Sea_Life,
Anim_2_Insect,
Anim_3_Mammal,
Anim_4_Reptile,
Anim_5_Bird]
EleMineral = [Elem_1_Fire_Electric,
Elem_2_Liquid,
Elem_3_Earth_Metal,
Elem_4_Astral_Atmosphere]
Veggie = [Vegi_1_Plant,
Vegi_2_Fruit_Vegi,
Vegi_3_Fungi,
Vegi_4_Tree]
Techne = [Tech_1_Transportation,
Tech_2_Architecture,
Tech_3_Tool,
Tech_4_Machine]
Visual_Elements = [Anima, Veggie, EleMineral, Techne]
Character_Elements = [Emotions, Actions]
All_Things = [Visual_Elements, Character_Elements]
from random import choice
def RecurseChoice(Root):
# Randomly select from nested lists until you get to
# a string instead of a list. Return the string.
if isinstance(Root,str):
return Root
else:
Sub_Root = choice(Root)
return RecurseChoice(Sub_Root)
#Choose one from each category
'''
print("Anima: ", end='')
print(RecurseChoice(Anima))
print("Veggie: ", end='')
print(RecurseChoice(Veggie))
print("EleMineral: ", end='')
print(RecurseChoice(EleMineral))
print("Techne: ", end='')
print(RecurseChoice(Techne))
print("Emotions: ", end='')
print(RecurseChoice(Emotions))
print("Actions: ", end='')
print(RecurseChoice(Actions))'''
def repl(text):
result = text.replace(": ","-").replace(", ","-").replace(" ","-")
return result
def generate_prompt():
visual = repl(RecurseChoice( Visual_Elements ) )
style = repl(RecurseChoice( Visual_Elements ) )
mood = repl(RecurseChoice( Character_Elements ) )
prompt = f"form of {visual} made of {style} with the mood {mood}, in the style of concept art, fantasy genesis --s 150 --ar 16:9 --c 5 --q 0.5"
print(prompt)
input("copy it and press Enter for another")
if __name__ == '__main__':
while True:
generate_prompt()
# Some test stuff
# Run it a ton of times looking for an entry
# or just checking for a crash, that too.
'''
Search_target = "Narwhale"
Number_of_tries = 4000
for i in range(Number_of_tries):
result = RecurseChoice(All_Things)
if result == Search_target: print("Target found! Try #{}".format(i))
'''
'''
try:
import pyperclip
pyperclip.copy(prompt)
except:
pass'''