Update README.md
Browse files
README.md
CHANGED
@@ -19,98 +19,101 @@ Examples:
|
|
19 |
import random
|
20 |
import functools
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
"female": {"
|
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 |
if __name__ == "__main__":
|
113 |
-
|
|
|
114 |
```
|
115 |
|
116 |
|
|
|
19 |
import random
|
20 |
import functools
|
21 |
|
22 |
+
class REMSleepPrmAnime:
|
23 |
+
def __init__(self):
|
24 |
+
# Time
|
25 |
+
self.year_range = {"both": {"newest", "recent", "mid", "early", "oldest"}}
|
26 |
+
|
27 |
+
# --- Subject
|
28 |
+
# Head
|
29 |
+
self.haircuts = {"both": {"bob", "pixie", "cut", "shaggy", "layers", "mullet", "afro", "fringe", "bangs", "quiff", "undercut", "braids", "knot", "ponytail", "curls", "blunt", "perm", "fade", "crop", "bowl", "curtain", "top", "balayage", "shag", "bang", "waves"},
|
30 |
+
"male": {"mohawk", "dreadlocks"}}
|
31 |
+
self.eye_colors = {"both": {"blue", "red", "yellow", "green", "orange", "red-orange", "yellow-orange", "yellow-green", "blue-green"} | {"gray", "amber", "hazel", "gold", "silver"},
|
32 |
+
"female": {"pink", "purple", "red-purple", "blue-purple"}}
|
33 |
+
self.eye_shapes = {"both": {"normal", "large", "moe", "realistic", "cat", "wolf", "dog", "bird", "no irises", "heterochromia", "glowing", "small", "starburst pupils", "googly", "tearful", "chibi"}, "female": {"shoujo"}}
|
34 |
+
self.blush = {"female": {"blush"}}
|
35 |
+
self.eyebrow_shapes = {"both": {"straight", "curved", "angular", "thick", "thin", "high arched", "low arched", "rounded", "uneven"}}
|
36 |
+
self.lips_shapes = {"both": {"small", "wide", "round"}}
|
37 |
+
self.nose_shapes = {"both": {"aquiline", "straight", "bulbous", "button", "hooked", "flat", "snub", "roman", "turned up", "pointy"}}
|
38 |
+
self.earrings = {"both": {"earrings"}}
|
39 |
+
|
40 |
+
# Outfit
|
41 |
+
self.outfit_colors = {"both": {"orange and white", "pale lilac and medium lavender", "hunter green and medium brown", "red and green", "navy blue and mustard yellow", "dark green and tan", "navy and white", "burgundy and gray", "burgundy and light brown", "navy blue and tan", "golden yellow and medium blue", "red and mustard yellow", "yellow and white", "maroon and gray", "black and white", "seal brown and tan", "charcoal gray and white", "blue-green and coral", "sky blue and charcoal gray", "red and light blue", "medium blue and chocolate brown", "medium green and white", "red and taupe", "red and mint green", "slate blue and warm white", "beige and maroon", "yellow and blue", "blue and orange", "pastel blue and yellow-orange", "bright blue and soft gray", "red and gray", "red and cyan", "red and yellow", "cerulean and neon green", "neon green and neon yellow", "navy blue and red", "sherbet orange and cool gray", "olive green and yellow", "yellow and deep sky blue", "dark brown and light blue", "magenta and charcoal", "red and white", "yellow and forest green", "light blue and navy blue", "orange and yellow", "charcoal grey and light blue", "pale coral and tan", "mauve-gray and olive", "yellow-orange and burnt orange", "orange and brown", "navy and light blue", "red and orange", "green and yellow", "gray and black", "green and blue", "teal and navy blue", "magenta and yellow", "yellow and brown", "red and black", "orange and green", "clay red and cerulean", "bright red and army green", "black and gray", "orange and black", "sage green and tan", "blue and turquoise", "beige and brown", "red and earthy browns", "dark green and gray", "blue and cyan", "olive green and navy blue", "olive green and maroon", "yellow and warm gray", "green and earthy browns", "burgundy and light blue", "khaki and pastel yellow", "taupe and white", "sky blue and royal blue", "orange and gray", "olive green and beige", "beige and blue", "burnt orange and hunter green", "blue and red", "navy blue and khaki"},
|
42 |
+
"female": {"blush pink and white", "pink and red", "pink and orange", "gray and light pink", "dark green and pink", "pink and warm black", "pink and blue", "medium pink and red", "rose pink and periwinkle", "yellow and pink", "purple and pink", "pink and turquoise", "pink and green", "navy blue and pink", "purple and charcoal gray", "turquoise and purple", "purple and yellow", "electric purple and black", "purple and orange", "green and purple", "red and purple"}}
|
43 |
+
self.tops = {"female": {"t-shirts", "blouses", "tunics", "camisoles", "tank tops", "crewneck", "v-neck", "cardigan", "turtleneck", "pullovers", "henleys", "crop tops", "off-the-shoulder tops", "cold shoulder tops", "peplum tops"}}
|
44 |
+
self.bottoms = {"both": {"shorts", "chinos", "cargo pants"},
|
45 |
+
"female": {"skinny jeans", "straight jeans", "bootcut jeans", "flare jeans", "wide-leg jeans", "bermuda shorts", "hotpants", "A-line skirts", "pencil skirts", "maxi skirts", "midi skirts", "mini skirts", "dress pants", "linen pants", "capris"} | \
|
46 |
+
{"stockings", "tights", "fishnets", "leggings", "yoga pants"}}
|
47 |
+
self.one_piece = {"female": {"jumpsuits", "rompers", "swimsuits", "bodysuits"}}
|
48 |
+
|
49 |
+
# Personality
|
50 |
+
self.personality_traits = {"both": {"creative", "determined", "enthusiastic", "friendly", "generous", "humorous", "intelligent", "kind", "loyal", "motivated", "optimistic", "persistent", "resilient", "sincere", "thoughtful", "trustworthy", "versatile", "compassionate", "ambitious", "confident", "honest", "brave", "patient", "reliable", "adventurous", "charismatic", "gracious", "insightful", "perceptive", "resourceful", "selfless", "talented", "witty", "zealous"}}
|
51 |
+
|
52 |
+
# Actions
|
53 |
+
self.actions = {"both": {"walking", "running", "squatting", "crawling", "riding", "speaking", "dancing", "waving", "listening", "reading", "pulling", "carrying", "studying", "bending", "writing", "lifting", "sleeping", "lying down", "pushing", "drinking", "clapping", "playing", "typing", "reaching", "working", "climbing", "jumping", "swimming", "kneeling", "watching", "standing", "eating"}}
|
54 |
+
# ---
|
55 |
+
|
56 |
+
# Camera angles
|
57 |
+
self.camera_angels = {"both": {"low-angle", "eye level", "high-angle", "hip level", "knee level", "ground level", "shoulder level", "dutch angle", "overhead", "aerial"}}
|
58 |
+
|
59 |
+
# Places and eras
|
60 |
+
self.places = {"both": {"school", "skyscrapers", "neon lights", "crowded streets", "medieval kingdoms", "magical forests", "post-apocalyptic wastelands", "spaceships", "colonies on other planets", "vinland saga", "haunted houses", "cursed islands", "mystical dimensions", "training grounds", "stadiums", "arenas"}}
|
61 |
+
self.eras = {"both": {"meiji period", "edo period"}}
|
62 |
+
|
63 |
+
# Styles
|
64 |
+
self.resolution = {"both": {"sharp focus", "8k"}}
|
65 |
+
self.lighting = {"both": {"rim lighting", "flat lighting", "cinematic lighting", "crepuscular rays"}}
|
66 |
+
|
67 |
+
def main(self):
|
68 |
+
def get_random_x(x, gender=["both"]):
|
69 |
+
concat = sum([list(x.get(ge, [])) for ge in gender], [])
|
70 |
+
return concat[random.randint(0, len(concat) - 1)] if len(concat) else ""
|
71 |
+
|
72 |
+
rand50 = lambda: random.randint(1, 100) <= 50
|
73 |
+
rand85 = lambda: random.randint(1, 100) <= 85
|
74 |
+
|
75 |
+
gender = "1girl" if rand50() else "1boy"
|
76 |
+
gender_selection = ["both"] + ["female" if gender == "1girl" else "male"]
|
77 |
+
get_random_x_by_gender = functools.partial(get_random_x, gender=gender_selection)
|
78 |
+
|
79 |
+
commands = (
|
80 |
+
# You must put trailing comma to convert a parenthesized expression into a tuple
|
81 |
+
(self.year_range,),
|
82 |
+
(self.personality_traits if rand50() else None,),
|
83 |
+
(self.actions,),
|
84 |
+
|
85 |
+
(self.eye_colors, self.haircuts, "haircut",),
|
86 |
+
(self.eye_colors, self.eye_shapes, "eyes",),
|
87 |
+
(self.blush if rand50() else None,),
|
88 |
+
# (self.eyebrow_shapes, "eyebrows",), # Diffusers are bad at drawing eyebrows
|
89 |
+
# (self.lips_shapes, "lips",), # Diffusers are bad at drawing lips
|
90 |
+
# (self.nose_shapes, "nose",), # Diffusers are bad at drawing nose
|
91 |
+
(self.earrings if rand50() else None,),
|
92 |
+
|
93 |
+
(self.outfit_colors, "outfit",),
|
94 |
+
*(((self.one_piece,),) if rand50() else ((self.tops,), (self.bottoms,))),
|
95 |
+
|
96 |
+
(self.camera_angels, "shot",),
|
97 |
+
((self.places,) if rand85() else (self.eras,)),
|
98 |
+
|
99 |
+
# ("masterpiece",), ("best quality",), ("very aesthetic",), ("absurdres",), # Already prepended
|
100 |
+
(self.resolution if rand50() else None,),
|
101 |
+
(self.lighting if rand50() else None,),
|
102 |
+
)
|
103 |
+
|
104 |
+
output = [gender] + [
|
105 |
+
" ".join(
|
106 |
+
get_random_x_by_gender(elem) if isinstance(elem, dict) else elem
|
107 |
+
for elem in cmd
|
108 |
+
if elem is not None and isinstance(elem, (str, dict))
|
109 |
+
) for cmd in commands
|
110 |
+
]
|
111 |
+
|
112 |
+
return ", ".join([s for s in output if s != ""])
|
113 |
|
114 |
if __name__ == "__main__":
|
115 |
+
prompt_generator = REMSleepPrmAnime()
|
116 |
+
[print(prompt_generator.main()) for _ in range(1)]
|
117 |
```
|
118 |
|
119 |
|