KKNTR commited on
Commit
0745769
·
verified ·
1 Parent(s): 9a04c6e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +198 -0
app.py CHANGED
@@ -41,6 +41,201 @@ for key, spec in STYLE_LORAS.items():
41
  if repo and adapter_name:
42
  pipe.load_lora_weights(repo, adapter_name=adapter_name)
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  resolutions = [
45
  (592, 1768), (608, 1696), (640, 1624), (672, 1544),
46
  (720, 1440), (744, 1392), (784, 1320), (832, 1248),
@@ -56,6 +251,9 @@ def generate(prompt, negative_prompt, width, height, random_res, selected_style)
56
  if random_res:
57
  width, height = random.choice(resolutions)
58
 
 
 
 
59
  # Rakennetaan listat aktiivisista adaptereista ja niiden painoista
60
  adapter_names = []
61
  adapter_weights = []
 
41
  if repo and adapter_name:
42
  pipe.load_lora_weights(repo, adapter_name=adapter_name)
43
 
44
+ scratchpad = {
45
+ "animal": [
46
+ "kangaroo", "kangaroo", "otter", "otter", "shark", "shark", "shark", "dolphin", "dolphin", "avian", "tiger", "lion", "wolf", "fox", "polar bear", "polar bear", "deer", "deer", "reindeer", "reindeer", "hyena", "bull", "bull",
47
+ "rabbit", "panther", "moose", "cheetah", "badger", "striped hyena", "rat", "leopard", "thylacine", "bighorn sheep",
48
+ "zebra", "horse", "horse", "donkey", "donkey", "unicorn", "white unicorn", "alligator", "western dragon", "lizard", "crocodile", "theropod",
49
+ "kangaroo", "otter", "tiger", "lion", "wolf", "fox", "polar bear", "deer", "reindeer", "hyena", "bull",
50
+ "rabbit", "panther", "moose", "cheetah", "badger", "striped hyena", "rat", "leopard", "thylacine", "bighorn sheep",
51
+ "zebra", "horse", "donkey", "unicorn", "white unicorn", "alligator", "western dragon", "lizard", "crocodile", "theropod",
52
+ "kangaroo", "otter", "tiger", "lion", "wolf", "fox", "polar bear", "deer", "reindeer", "hyena", "bull",
53
+ "rabbit", "panther", "moose", "cheetah", "badger", "striped hyena", "rat", "leopard", "thylacine", "bighorn sheep",
54
+ "zebra", "horse", "donkey", "unicorn", "white unicorn", "alligator", "western dragon", "lizard", "crocodile", "theropod",
55
+ "black russian terrier", "pit bull", "schnauzer", "dobermann", "mastiff", "molosser", "pinscher", "rottweiler", "tamaskan dog",
56
+ "wolfdog", "alaskan husky", "alaskan malamute", "canadian eskimo dog", "german shepherd", "labrador husky", "siberian husky",
57
+ "labrador", "golden retriever", "dalmatian", "border collie", "collie", "herding dog", "pastoral dog", "sheepdog",
58
+ "carolina dog", "rhodesian ridgeback", "nordic sled dog", "spitz", "husky", "akita", "mountain dog", "primitive dog",
59
+ "siberian retriever", "hunting dog", "australian cattle dog", "crash bandicoot", "montgomery gator, fnaf", "bear",
60
+ "parrot", "bison", "buffalo", "cattle", "muskox", "yak", "alpaca", "goat", "sheep", "deer", "elk", "moose", "reindeer", "white-tailed deer",
61
+ "raccoon", "skunk", "whale", "tasmanian devil", "badger", "ermine", "ferret", "marten", "mink", "otter", "weasel", "wolverine", "squirrel",
62
+ "white rabbit", "pegasus", "goat", "mouse", "cattle", "coyote", "owl", "charizard", "bandicoot", "giant panda", "panda", "bat", "ocelot", "panther",
63
+ "cheetah", "cougar", "puma", "pony", "camel", "llama", "penguin", "pigeon", "roadrunner", "seagull", "flamingo", "duck",
64
+ ],
65
+
66
+ "pose": [
67
+ "flexing", "double biceps pose", "side chest pose", "front lat spread pose", "back double biceps pose", "side biceps pose",
68
+ "adonis pose", "arms akimbo", "crossed arms", "hands on hips", "hands behind head", "one hand behind head", "torso twist", "power stance",
69
+ "v-shape", "clenched fists", "palm open", "fist pump", "victory pose", "comic shrug", "superhero pose", "front double biceps pose",
70
+ "front lat spread pose", "side chest pose", "side triceps pose", "rear double biceps pose", "rear lat spread pose",
71
+ "most muscular pose", "abdominal and thigh pose", "hands-on hips pose",
72
+ ],
73
+
74
+ "swimwear": [
75
+ "swimming trunks", "swim shorts", "swim briefs", "speedo", "boxer swim shorts", "bermuda swim shorts", "swimming thong",
76
+ "swim g-string", "board shorts", "jammers", "tight swim shorts", "loose swim shorts", "short swim trunks",
77
+ ],
78
+
79
+ "headwear": [
80
+ "baseball cap", "backwards headwear", "backwards baseball cap", "snapback cap", "backwards snapback cap", "trucker hat", "backwards trucker hat",
81
+ "fitted cap", "beanie hat", "headband",
82
+ "bandana",
83
+ ],
84
+
85
+ "setting:private": [
86
+ "bedroom", "bathroom", "shower", "bathtub"
87
+ "locker room", "changing room", "dressing room",
88
+ "communal shower", "forest", "tent", "poolside",
89
+ "sauna", "hot tub", "jacuzzi",
90
+ "gym locker room", "living room", "beach",
91
+ ],
92
+
93
+ "setting:semi": [
94
+ "bedroom", "living room", "locker room", "beach", "tent", "beach",
95
+ ],
96
+
97
+ "setting:public": [
98
+ "living room", "library", "classroom", "train station", "subway station", "bus stop", "parking lot", "street", "alleyway",
99
+ "rooftop", "city street", "shopping mall", "supermarket", "gas station", "restaurant", "cafe", "bar",
100
+ ],
101
+
102
+ "setting:party": [
103
+ "nightclub", "bar", "club", "dance floor", "music festival",
104
+ "rooftop party", "late-night street party", "party", "summer party", "beach party", "dance club", "strip club", "rave club", "bar counter",
105
+ ],
106
+
107
+ "setting:water": [
108
+ "beach", "seashore", "lake shore", "riverbank", "swimming pool", "private pool", "poolside",
109
+ "deck by the pool", "beach lounge", "hot tub", "jacuzzi",
110
+ ],
111
+
112
+ "setting:underwater": [
113
+ "pool", "jacuzzi", "hot tub", "spa pool", "sea", "lake", "river",
114
+ ],
115
+
116
+ "hair": [
117
+ "bald", "short hair", "medium hair", "long hair", "man bun", "ponytail", "crew cut", "undercut", "side part", "spiky hair", "messy hair",
118
+ "curly hair", "wavy hair", "straight hair",
119
+ ],
120
+
121
+ "accessories": [
122
+ "earrings", "stud earrings", "diamond stud earrings", "hoop earrings", "small hoop earrings", "septum piercing", "eyebrow piercing",
123
+ "chain necklace", "beaded necklace", "pendant necklace", "sunglasses", "aviator sunglasses", "wayfarer sunglasses", "sports sunglasses",
124
+ "headphones", "earphones",
125
+ ],
126
+
127
+ "hairy:face": [
128
+ "beard", "goatee", "soul patch", "sideburns", "stubble", "full beard", "short beard", "long beard", "chin strap", "van dyke", "mutton chops", "scruffy beard", "designer stubble",
129
+ ],
130
+
131
+ "hairy:body": [
132
+ "chest hair", "armpit hair", "happy trail", "pubic hair",
133
+ "chest hair + armpit hair", "chest hair + happy trail", "chest hair + pubic hair", "armpit hair + happy trail", "armpit hair + pubic hair",
134
+ "happy trail + pubic hair", "chest hair + armpit hair + happy trail", "chest hair + armpit hair + pubic hair", "chest hair + happy trail + pubic hair",
135
+ "armpit hair + happy trail + pubic hair", "chest hair + armpit hair + happy trail + pubic hair",
136
+ ],
137
+
138
+ "body": [
139
+ "very skinny", "lean", "fit", "toned", "athletic", "muscular", "broad-shouldered", "stocky", "solid", "heavily muscled", "chubby", "big and muscular", "obese",
140
+ ],
141
+
142
+ "underwear": [
143
+ "boxer briefs", "briefs", "boxers", "trunks", "thong", "g-string", "string thong", "jockstrap", "low-rise briefs", "mid-rise briefs",
144
+ "high-rise briefs", "athletic briefs",
145
+ ],
146
+
147
+ "sex:anal": [
148
+ "mating press", "chair position", "cowgirl position", "doggystyle", "leg glider position", "mastery position",
149
+ "Spoon Position", "reverse missionary position", "missionary position", "reverse cowgirl position",
150
+ "anvil Position", "guard Position", "stand and carry Position", "table lotus position"
151
+ ],
152
+
153
+ "sex:oral": [
154
+ "69 position", "kneeling oral position", "sideways oral", "penis lick", "tongue in foreskin", "deepthroath", "tongue out blowjob", "irrumatio",
155
+ "ball lick", "kneeling and blow position", "lying and blow position", "north pole position", "sit and blow position",
156
+ ],
157
+
158
+ "topwear:under": [
159
+ "tank top", "tank top", "loose tank top, extended armholes, draped sleeveless shirt", "oversized muscle tank, baggy sleeveless top, open armholes",
160
+ "t-shirt", "crew-neck t-shirt", "v-neck t-shirt", "sleeveless shirt", "cotton undershirt",
161
+ ],
162
+
163
+ "topwear:casual": [
164
+ "long-sleeve t-shirt", "crew-neck long-sleeve shirt", "v-neck long-sleeve shirt", "henley long-sleeve", "hoodie",
165
+ "sweatshirt", "zip-up hoodie", "pullover sweater", "thermal shirt", "flannel shirt",
166
+ ],
167
+
168
+ "topwear:formal": [
169
+ "button-up long-sleeve shirt", "collared shirt", "dress shirt", "oxford shirt", "polo shirt", "unbuttoned shirt, flannel shirt,"
170
+ ],
171
+
172
+ "topwear:party": [
173
+ "mesh tank top", "mesh shirt", "harness", "cage top", "leather vest", "rubber shirt", "tight tank top", "open shirt", "crop top",
174
+ "fishnet top", "bondage harness", "strappy top", "latex shirt", "transparent shirt", "studded vest", "festival top", "topless", "topless",
175
+ ],
176
+
177
+ "bottomwear:formal": [
178
+ "jeans", "chinos", "khaki pants", "linen trousers", "cotton trousers", "dress trousers", "slacks", "wool trousers", "formal pants",
179
+ ],
180
+
181
+ "bottomwear:casual": [
182
+ "joggers", "sweatpants", "track pants", "gym shorts", "shorts", "linen shorts", "bermuda shorts", "cargo pants", "basketball shorts", "training pants",
183
+ ],
184
+
185
+ "bottomwear:party": [
186
+ "camo pants", "leather pants", "rubber pants", "cargo pants", "denim pants", "tight jeans", "distressed jeans", "ripped jeans", "patent leather pants",
187
+ "bondage pants", "festival trousers", "shiny pants", "studded pants", "paint-splatter pants", "metallic pants", "faux leather pants", "tight cargo pants",
188
+ "plaid pants",
189
+ ],
190
+
191
+ "light": [
192
+ "daylight", "bright light", "soft light", "dim light", "night", "ambient light", "diffuse light", "even lighting", "natural light", "low light",
193
+ "dappled light", "soft shadows", "subtle highlights", "warm light", "cool light" "dusty light", "hazy light", "soft glow", "subtle lens flare",
194
+ "misty light", "warm haze", "cool haze",
195
+ ],
196
+
197
+ "perspective": [
198
+ "front view", "side view", "three-quarter view", "top-down view", "worm's-eye view", "high-angle view", "low-angle view",
199
+ "overhead view", "diagonal view", "isometric view", "dutch angle", "fisheye perspective", "foreshortening",
200
+ ],
201
+
202
+ "effect": [
203
+ "soft focus", "slight blur", "bokeh", "grainy texture", "film grain", "vignette", "subtle glow", "soft haze", "hazy atmosphere",
204
+ "light diffusion", "slight overexposure", "subtle underexposure", "warm tint", "cool tint", "muted colors", "slightly desaturated",
205
+ "painterly effect", "sketch effect", "cartoonish style", "comic style"
206
+ ],
207
+
208
+ "face": [
209
+ "flirty", "seductive", "playful flirt", "teasing look", "sultry gaze", "wink flirt", "one eye closed", "smoldering look", "cheeky flirt", "suggestive grin",
210
+ "mischievous smirk", "playful smirk", "tongue out flirty", "open mouth flirt", "eye contact flirt", "raised eyebrow flirt", "smiling", "grinning", "laughing", "happy",
211
+ "joyful", "playful", "quirky", "cheerful", "friendly smile", "tongue out", "winking", "raised eyebrows", "blushing", "embarrassed", "shy", "bashful", "surprised",
212
+ "curious", "amused", "satisfied smile", "soft smile", "teasing smile", "cheeky grin", "slight smirk", "mischievous grin", "open mouth smile", "excited", "delighted",
213
+ "flirty", "seductive", "playful flirt", "teasing look", "sultry gaze", "wink flirt",
214
+ ],
215
+
216
+ "color": [
217
+ "red", "scarlet", "crimson", "pink", "magenta", "fuchsia", "orange", "tangerine", "yellow", "bright yellow", "lemon yellow color", "gold color", "green", "lime green color",
218
+ "emerald", "olive", "teal", "turquoise", "cyan", "blue", "sky blue", "royal blue", "navy blue", "indigo", "purple", "violet", "lavender", "lilac", "brown", "tan",
219
+ "beige", "bronze", "maroon", "burgundy", "white", "ivory", "black", "grey", "dark-grey", "light-grey", "silver", "reflecting chrome", "copper", "mint", "jade",
220
+ "peach color", "camo", "camouflage", "red-violet", "blue-green", "turquoise-blue", "yellow-orange", "pink-purple", "mustard color",
221
+ ],
222
+ }
223
+
224
+ def apply_scratchpad(prompt: str) -> str:
225
+ """Korvaa [tagi] scratchpadin vaihtoehdoilla satunnaisesti.
226
+ Jos tagia ei löydy, poistetaan hakasulkeet kokonaan.
227
+ """
228
+ matches = re.findall(r"\[(.+?)\]", prompt)
229
+ for tag in matches:
230
+ if tag in scratchpad:
231
+ choice = random.choice(scratchpad[tag])
232
+ # korvataan ilman hakasulkeita
233
+ prompt = prompt.replace(f"[{tag}]", choice, 1)
234
+ else:
235
+ # poistetaan tuntemattomat tagit
236
+ prompt = prompt.replace(f"[{tag}]", "", 1)
237
+ return prompt.strip()
238
+
239
  resolutions = [
240
  (592, 1768), (608, 1696), (640, 1624), (672, 1544),
241
  (720, 1440), (744, 1392), (784, 1320), (832, 1248),
 
251
  if random_res:
252
  width, height = random.choice(resolutions)
253
 
254
+ # Expandataan scratchpad-tagit
255
+ prompt = apply_scratchpad(prompt)
256
+
257
  # Rakennetaan listat aktiivisista adaptereista ja niiden painoista
258
  adapter_names = []
259
  adapter_weights = []