File size: 4,329 Bytes
26a8a94 387f1c0 767ae66 387f1c0 26a8a94 387f1c0 767ae66 387f1c0 26a8a94 497250a 26a8a94 497250a 387f1c0 26a8a94 |
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 |
import torch
from diffusers import StableDiffusionXLPipeline
import gradio as gr
import spaces
import random
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()
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),
]
lora_styles = {
"None": (None, 0.0, ""),
"Foreskin play": ("kkntr/lora5", 1.2, "foreskin insertion"),
"Cum through clothing": ("kkntr/lora6", 1.2, "cum in clothing"),
"Penis through leghole": ("kkntr/lora7", 9.0, "(((penis through leghole))), (loose shorts), (penis outline), poking out, genital outline, bulge flowing sideways along thigh, visible penis shape under fabric, tight crotch, fabric tension"),
"Frottage": ("kkntr/lora8", 1.2, "byfrottage, frottage"),
"Penis towards viewer": ("kkntr/lora9", 1.2, "penis_towards_viewer"),
"Foreskin play closeup": ("kkntr/lora11", 2.0, "ZonkFS"),
}
@spaces.GPU
def generate(prompt, negative_prompt, width, height, random_res, selected_style):
if random_res:
width, height = random.choice(resolutions)
# Valitaan tyyli-LoRA ja lisätään triggeri
lora_addition = {}
if selected_style != "None" and selected_style in lora_styles:
lora_path, lora_strength, lora_trigger = lora_styles[selected_style]
prompt = f"{lora_trigger}, {prompt}"
lora_addition[lora_path] = lora_strength
# Ladataan pysyvät + tyyli-LoRA yhteen
all_loras = {
"kkntr/lora1": 0.2,
"kkntr/lora2": 0.3,
"kkntr/lora12": 0.4,
"kkntr/lora10": 0.1,
}
all_loras.update(lora_addition) # ← MUUTETTU
pipe.load_lora_weights(all_loras) # ← MUUTETTU
pipe.fuse_lora() # ← MUUTETTU
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=35,
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, overexposure, bad artist, bad composition, distorted, oversaturated, 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=1024, step=64, value=768, label="Width"),
gr.Slider(minimum=512, maximum=1024, step=64, value=768, label="Height"),
gr.Checkbox(label="Random resolution mode (override sliders)", value=True),
gr.Dropdown(
choices=list(lora_styles.keys()),
value="None",
label="Select Style"
)
],
outputs=[
gr.Image(label="Generated Image"),
gr.Textbox(label="Used Prompt", lines=4)
],
title="FURRYSTYLE",
description="Give a prompt"
).launch() |