File size: 15,509 Bytes
fd72886
 
38f0c8a
 
 
 
fd72886
38f0c8a
 
 
 
 
 
 
 
 
4514f9b
 
 
 
 
 
 
 
 
 
 
 
cbec701
5722460
45d5865
d1f9903
97f2c18
 
 
 
 
 
45d5865
 
 
 
 
7ef14dd
 
 
 
b3bc4b4
d1f9903
cbec701
ba6292b
 
 
 
 
cbec701
d1f9903
cbec701
ba6292b
 
a51f63d
d1f9903
97f2c18
ba6292b
 
7ef14dd
97f2c18
 
d1f9903
 
 
7ef14dd
 
 
4b28a58
97f2c18
d1f9903
7ef14dd
d1f9903
 
 
 
 
 
97f2c18
d1f9903
12d8425
 
d1f9903
 
 
7ef14dd
 
97f2c18
d1f9903
 
 
 
 
97f2c18
7ef14dd
471d05f
97f2c18
d1f9903
97f2c18
ba6292b
 
 
97f2c18
d1f9903
de9b61b
7ef14dd
de9b61b
a51f63d
de9b61b
 
 
 
 
cc811f4
d1f9903
cc811f4
ba6292b
cbec701
d1f9903
cbec701
ba6292b
 
78f6863
d1f9903
ba6292b
 
 
 
 
 
 
 
 
cbec701
d1f9903
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cbec701
d1f9903
 
 
a51f63d
d1f9903
 
 
a51f63d
d1f9903
 
 
 
 
45d5865
d1f9903
45d5865
ba6292b
 
 
45d5865
d1f9903
45d5865
ba6292b
 
 
 
 
 
 
 
45d5865
d1f9903
45d5865
ba6292b
 
 
 
 
cbec701
d1f9903
42d8cf5
ba6292b
 
 
 
b3bc4b4
38f0c8a
 
ad93407
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38f0c8a
4514f9b
 
 
 
 
 
 
 
c6c6365
 
 
 
 
 
 
 
4514f9b
 
38f0c8a
b3bc4b4
4514f9b
 
 
 
 
436675c
4514f9b
 
 
 
 
 
 
 
 
 
 
 
38f0c8a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2adc8da
38f0c8a
 
 
 
 
 
 
 
436675c
38f0c8a
 
ba6292b
38f0c8a
ba6292b
 
4514f9b
38f0c8a
 
 
 
 
4514f9b
7ef14dd
 
 
 
b3bc4b4
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
import spaces  # oltava ensimmäisenä!

import torch
from diffusers import StableDiffusionXLPipeline
import gradio as gr
import random
import re

model_id = "kkntr/sdxl-kkntr"

pipe = StableDiffusionXLPipeline.from_pretrained(
    model_id,
    torch_dtype=torch.float16,
    use_safetensors=True
).to("cuda")

pipe.load_lora_weights(
    {
        "kkntr/lora1": 0.2,
        "kkntr/lora2": 0.3,
        "kkntr/lora12": 0.4,
        "kkntr/lora10": 0.1,
    }
)
pipe.fuse_lora()

# Scratchpad vaihtoehdot
scratchpad = {
    "animal": [
        "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", 
"rabbit", "panther", "moose", "cheetah", "badger", "striped hyena", "rat", "leopard", "thylacine", "bighorn sheep", 
"zebra", "horse", "horse", "donkey", "donkey", "unicorn", "white unicorn", "alligator", "western dragon", "lizard", "crocodile", "theropod",
"kangaroo", "otter", "tiger", "lion", "wolf", "fox", "polar bear", "deer", "reindeer", "hyena", "bull", 
"rabbit", "panther", "moose", "cheetah", "badger", "striped hyena", "rat", "leopard", "thylacine", "bighorn sheep", 
"zebra", "horse", "donkey", "unicorn", "white unicorn", "alligator", "western dragon", "lizard", "crocodile", "theropod",
"kangaroo", "otter", "tiger", "lion", "wolf", "fox", "polar bear", "deer", "reindeer", "hyena", "bull", 
"rabbit", "panther", "moose", "cheetah", "badger", "striped hyena", "rat", "leopard", "thylacine", "bighorn sheep", 
"zebra", "horse", "donkey", "unicorn", "white unicorn", "alligator", "western dragon", "lizard", "crocodile", "theropod",
"black russian terrier", "pit bull", "schnauzer", "dobermann", "mastiff", "molosser", "pinscher", "rottweiler", "tamaskan dog", 
"wolfdog", "alaskan husky", "alaskan malamute", "canadian eskimo dog", "german shepherd", "labrador husky", "siberian husky", 
"labrador", "golden retriever", "dalmatian", "border collie", "collie", "herding dog", "pastoral dog", "sheepdog", 
"carolina dog", "rhodesian ridgeback", "nordic sled dog", "spitz", "husky", "akita", "mountain dog", "primitive dog", 
"siberian retriever", "hunting dog", "australian cattle dog", "crash bandicoot", "montgomery gator, fnaf", "bear",
"parrot", "bison", "buffalo", "cattle", "muskox", "yak", "alpaca", "goat", "sheep", "deer", "elk", "moose", "reindeer", "white-tailed deer",
"raccoon", "skunk", "whale", "tasmanian devil", "badger", "ermine", "ferret", "marten", "mink", "otter", "weasel", "wolverine", "squirrel",
"white rabbit", "pegasus", "goat", "mouse", "cattle", "coyote", "owl", "charizard", "bandicoot", "giant panda", "panda", "bat", "ocelot", "panther",
"cheetah", "cougar", "puma", "pony", "camel", "llama", "penguin", "pigeon", "roadrunner", "seagull", "flamingo", "duck", 
    ],

    "pose": [
        "flexing", "double biceps pose", "side chest pose", "front lat spread pose", "back double biceps pose", "side biceps pose",
"adonis pose", "arms akimbo", "crossed arms", "hands on hips", "hands behind head", "one hand behind head", "torso twist", "power stance",
"v-shape", "clenched fists", "palm open", "fist pump", "victory pose", "comic shrug", "superhero pose", "front double biceps pose",
"front lat spread pose", "side chest pose", "side triceps pose", "rear double biceps pose", "rear lat spread pose",
"most muscular pose", "abdominal and thigh pose", "hands-on hips pose",
    ],

    "swimwear": [
        "swimming trunks", "swim shorts", "swim briefs", "speedo", "boxer swim shorts", "bermuda swim shorts", "swimming thong",
"swim g-string", "board shorts", "jammers", "tight swim shorts", "loose swim shorts", "short swim trunks",
    ],

    "headwear": [
        "baseball cap", "backwards headwear", "backwards baseball cap", "snapback cap", "backwards snapback cap", "trucker hat", "backwards trucker hat",
"fitted cap", "beanie hat", "headband",
"bandana",
    ],

    "setting:private": [
        "bedroom", "bathroom", "shower", "bathtub"
"locker room", "changing room", "dressing room", 
"communal shower", "forest", "tent", "poolside",
"sauna", "hot tub", "jacuzzi", 
"gym locker room", "living room", "beach",
    ],

    "setting:semi": [
        "bedroom", "living room", "locker room", "beach", "tent", "beach",
    ],
    
    "setting:public": [
        "living room", "library", "classroom", "train station", "subway station", "bus stop", "parking lot", "street", "alleyway",
"rooftop", "city street", "shopping mall", "supermarket", "gas station", "restaurant", "cafe", "bar",
    ],

    "setting:party": [
        "nightclub", "bar", "club", "dance floor", "music festival",
"rooftop party", "late-night street party", "party", "summer party", "beach party", "dance club", "strip club", "rave club", "bar counter",
    ],
    
    "setting:water": [
        "beach", "seashore", "lake shore", "riverbank", "swimming pool", "private pool", "poolside",
"deck by the pool", "beach lounge", "hot tub", "jacuzzi",
    ],
    
    "setting:underwater": [
        "pool", "jacuzzi", "hot tub", "spa pool", "sea", "lake", "river",
    ],

    "hair": [
        "bald", "short hair", "medium hair", "long hair", "man bun", "ponytail", "crew cut", "undercut", "side part", "spiky hair", "messy hair",
"curly hair", "wavy hair", "straight hair",
    ],

    "accessories": [
        "earrings", "stud earrings", "diamond stud earrings", "hoop earrings", "small hoop earrings", "septum piercing", "eyebrow piercing",
"chain necklace", "beaded necklace", "pendant necklace", "sunglasses", "aviator sunglasses", "wayfarer sunglasses", "sports sunglasses",
"headphones", "earphones",
    ],

    "hairy:face": [
        "beard", "goatee", "soul patch", "sideburns", "stubble", "full beard", "short beard", "long beard", "chin strap", "van dyke", "mutton chops", "scruffy beard", "designer stubble",
    ],

    "hairy:body": [
        "chest hair", "armpit hair", "happy trail", "pubic hair",
"chest hair + armpit hair", "chest hair + happy trail", "chest hair + pubic hair", "armpit hair + happy trail", "armpit hair + pubic hair",
"happy trail + pubic hair", "chest hair + armpit hair + happy trail", "chest hair + armpit hair + pubic hair", "chest hair + happy trail + pubic hair",
"armpit hair + happy trail + pubic hair", "chest hair + armpit hair + happy trail + pubic hair",
    ],

    "body": [
        "very skinny", "lean", "fit", "toned", "athletic", "muscular", "broad-shouldered", "stocky", "solid", "heavily muscled", "chubby", "big and muscular", "obese",
    ],

    "underwear": [
        "boxer briefs", "briefs", "boxers", "trunks", "thong", "g-string", "string thong", "jockstrap", "low-rise briefs", "mid-rise briefs",
"high-rise briefs", "athletic briefs",
    ],

    "sex:anal": [
        "mating press", "chair position", "cowgirl position", "doggystyle", "leg glider position", "mastery position",
"Spoon Position", "reverse missionary position", "missionary position", "reverse cowgirl position",
"anvil Position", "guard Position", "stand and carry Position", "table lotus position"
    ],

    "sex:oral": [
        "69 position", "kneeling oral position", "sideways oral", "penis lick", "tongue in foreskin", "deepthroath", "tongue out blowjob", "irrumatio", 
"ball lick", "kneeling and blow position", "lying and blow position", "north pole position", "sit and blow position",
    ],

    "topwear:under": [
        "tank top", "tank top", "loose tank top, extended armholes, draped sleeveless shirt", "oversized muscle tank, baggy sleeveless top, open armholes",
"t-shirt", "crew-neck t-shirt", "v-neck t-shirt", "sleeveless shirt", "cotton undershirt",
    ],

    "topwear:casual": [
        "long-sleeve t-shirt", "crew-neck long-sleeve shirt", "v-neck long-sleeve shirt", "henley long-sleeve", "hoodie",
"sweatshirt", "zip-up hoodie", "pullover sweater", "thermal shirt", "flannel shirt",
    ],

    "topwear:formal": [
        "button-up long-sleeve shirt", "collared shirt", "dress shirt", "oxford shirt", "polo shirt", "unbuttoned shirt, flannel shirt,"
    ],

    "topwear:party": [
        "mesh tank top", "mesh shirt", "harness", "cage top", "leather vest", "rubber shirt", "tight tank top", "open shirt", "crop top",
"fishnet top", "bondage harness", "strappy top", "latex shirt", "transparent shirt", "studded vest", "festival top", "topless", "topless",
    ],
    
    "bottomwear:formal": [
        "jeans", "chinos", "khaki pants", "linen trousers", "cotton trousers", "dress trousers", "slacks", "wool trousers", "formal pants",
    ],

    "bottomwear:casual": [
        "joggers", "sweatpants", "track pants", "gym shorts", "shorts", "linen shorts", "bermuda shorts", "cargo pants", "basketball shorts", "training pants",
    ],

    "bottomwear:party": [
        "camo pants", "leather pants", "rubber pants", "cargo pants", "denim pants", "tight jeans", "distressed jeans", "ripped jeans", "patent leather pants",
"bondage pants", "festival trousers", "shiny pants", "studded pants", "paint-splatter pants", "metallic pants", "faux leather pants", "tight cargo pants",
"plaid pants",
    ],

    "light": [
        "daylight", "bright light", "soft light", "dim light", "night", "ambient light", "diffuse light", "even lighting", "natural light", "low light",
"dappled light", "soft shadows", "subtle highlights", "warm light", "cool light" "dusty light", "hazy light", "soft glow", "subtle lens flare",
"misty light", "warm haze", "cool haze",
    ],

    "perspective": [
        "front view", "side view", "three-quarter view", "top-down view", "worm's-eye view", "high-angle view", "low-angle view",
"overhead view", "diagonal view", "isometric view", "dutch angle", "fisheye perspective", "foreshortening",
    ],

    "effect": [
        "soft focus", "slight blur", "bokeh", "grainy texture", "film grain", "vignette", "subtle glow", "soft haze", "hazy atmosphere",
"light diffusion", "slight overexposure", "subtle underexposure", "warm tint", "cool tint", "muted colors", "slightly desaturated",
"painterly effect", "sketch effect", "cartoonish style", "comic style"
    ],

    "face": [
        "flirty", "seductive", "playful flirt", "teasing look", "sultry gaze", "wink flirt", "one eye closed", "smoldering look", "cheeky flirt", "suggestive grin",
"mischievous smirk", "playful smirk", "tongue out flirty", "open mouth flirt", "eye contact flirt", "raised eyebrow flirt", "smiling", "grinning", "laughing", "happy",
"joyful", "playful", "quirky", "cheerful", "friendly smile", "tongue out", "winking", "raised eyebrows", "blushing", "embarrassed", "shy", "bashful", "surprised",
"curious", "amused", "satisfied smile", "soft smile", "teasing smile", "cheeky grin", "slight smirk", "mischievous grin", "open mouth smile", "excited", "delighted",
"flirty", "seductive", "playful flirt", "teasing look", "sultry gaze", "wink flirt",
    ],

    "color": [
        "red", "scarlet", "crimson", "pink", "magenta", "fuchsia", "orange", "tangerine", "yellow", "bright yellow", "lemon yellow color", "gold color", "green", "lime green color",
"emerald", "olive", "teal", "turquoise", "cyan", "blue", "sky blue", "royal blue", "navy blue", "indigo", "purple", "violet", "lavender", "lilac", "brown", "tan",
"beige", "bronze", "maroon", "burgundy", "white", "ivory", "black", "grey", "dark-grey", "light-grey", "silver", "reflecting chrome", "copper", "mint", "jade", 
"peach color", "camo", "camouflage", "red-violet", "blue-green", "turquoise-blue", "yellow-orange", "pink-purple", "mustard color",
    ],
}

def apply_scratchpad(prompt: str) -> str:
    """Korvaa [tagi] scratchpadin vaihtoehdoilla satunnaisesti.
       Jos tagia ei löydy, poistetaan hakasulkeet kokonaan.
    """
    matches = re.findall(r"\[(.+?)\]", prompt)
    for tag in matches:
        if tag in scratchpad:
            choice = random.choice(scratchpad[tag])
            # korvataan ilman hakasulkeita
            prompt = prompt.replace(f"[{tag}]", choice, 1)
        else:
            # poistetaan tuntemattomat tagit
            prompt = prompt.replace(f"[{tag}]", "", 1)
    return prompt.strip()


resolutions = [
    (592, 1768), (608, 1696), (640, 1624), (672, 1544),
    (720, 1440), (744, 1392), (784, 1320), (832, 1248),
    (864, 1208), (880, 1184), (912, 1144), (976, 1072),
    (1024, 1024), (1072, 912), (1144, 912), (1184, 880),
    (1208, 864), (1248, 832), (1320, 784), (1392, 744),
    (1440, 720), (1544, 672), (1624, 640), (1696, 608),
    (1768, 592),
    (720, 1440), (744, 1392), (784, 1320), (832, 1248),
    (864, 1208), (880, 1184), (912, 1144), (976, 1072),
    (1024, 1024), (1072, 912), (1144, 912), (1184, 880),
    (1208, 864), (1248, 832), (1320, 784),
    (880, 1184), (912, 1144), (976, 1072),
    (1024, 1024), (1072, 912),
    (912, 1144), (976, 1072),
    (1024, 1024),
]


@spaces.GPU
def generate(prompt, negative_prompt, width, height, random_res, selected_style):
    if random_res:
        width, height = random.choice(resolutions)

    # Expandataan scratchpad-tagit
    prompt = apply_scratchpad(prompt)


    # Ladataan pysyvät + tyyli-LoRA yhteen
    all_loras = {
        "kkntr/lora1": 0.2,
        "kkntr/lora2": 0.3,
        "kkntr/lora12": 0.4,
        "kkntr/lora10": 0.1,
    }

    pipe.load_lora_weights(all_loras)
    pipe.fuse_lora()

    quality_suffix = (
        ", (anthro), (male), (best quality), high resolution, (ultra detailed),"
        " 8k, (highly detailed), (masterpiece), (sharp focus), (intricate details),"
        " (perfect anatomy), (depth of field), high dynamic range,"
        " (smooth shading), (realistic shadows), (rich texture),"
        " professional color grading, (fine details), ultra sharp,"
        " HDR, (anatomically correct), painterly realism, 20r0j_2, civifur"
    )

    full_prompt = prompt + quality_suffix

    image = pipe(
        prompt=full_prompt,
        negative_prompt=negative_prompt,
        width=width,
        height=height,
        num_inference_steps=40,
        guidance_scale=7.5
    ).images[0]

    return image, full_prompt

gr.Interface(
    fn=generate,
    inputs=[
        gr.Textbox(label="Prompt"),
        gr.Textbox(
            label="Negative Prompt",
            value="(worst quality), (low quality), (blurry), (bad anatomy), (fused fingers), (extra fingers), (missing fingers), (deformed), (jpeg artifacts), (watermark), (signature), text, error, out of frame, bad hands, bad feet, bad proportions, fused limbs, cropped, username, logo, bad perspective, lowres, bad artist, bad composition, distorted, mutated, bad shadow, multiple limbs, extra arms, extra legs, bad background, tilted, bad lighting, bad face, ugly, bad eyes, disfigured, multiple pictures"
        ),
        gr.Slider(minimum=512, maximum=1920, step=64, value=768, label="Width"),
        gr.Slider(minimum=512, maximum=1920, step=64, value=768, label="Height"),
        gr.Checkbox(label="Random resolution mode (override sliders)", value=True),
    ],
    outputs=[
        gr.Image(label="Generated Image"),
        gr.Textbox(label="Used Prompt", lines=4)
    ],
    title="FURRYSTYLE",
    description="animal,   body,   sex:anal/oral,   pose,   hairy:face/body,   "
    "topwear:under/casual/formal/party,   bottomwear:casual/formal/party,   " 
    "underwear,   swimwear,   headwear,   hair,   accessories,   face,   light,   perspective,   "
    "effect,   setting:private/semi/public/party/water/underwater,   color"
).launch()