KKNTR commited on
Commit
4812218
·
verified ·
1 Parent(s): d4c5bc7

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +133 -0
  2. requirements.txt +8 -0
app.py ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from diffusers import StableDiffusionXLPipeline
3
+ import gradio as gr
4
+ import spaces
5
+ import random
6
+
7
+ model_id = "kkntr/sdxl-kkntr"
8
+
9
+ pipe = StableDiffusionXLPipeline.from_pretrained(
10
+ model_id,
11
+ torch_dtype=torch.float16,
12
+ use_safetensors=True
13
+ ).to("cuda")
14
+
15
+ pipe.load_lora_weights(
16
+ {
17
+ "kkntr/lora1": 0.2,
18
+ "kkntr/lora2": 0.3,
19
+ "kkntr/lora12": 0.4,
20
+ "kkntr/lora10": 0.1,
21
+ }
22
+ )
23
+ pipe.fuse_lora()
24
+
25
+ resolutions = [
26
+ (592, 1768),
27
+ (608, 1696),
28
+ (640, 1624),
29
+ (672, 1544),
30
+ (720, 1440),
31
+ (744, 1392),
32
+ (784, 1320),
33
+ (832, 1248),
34
+ (864, 1208),
35
+ (880, 1184),
36
+ (912, 1144),
37
+ (976, 1072),
38
+ (1024, 1024),
39
+ (1072, 912),
40
+ (1144, 912),
41
+ (1184, 880),
42
+ (1208, 864),
43
+ (1248, 832),
44
+ (1320, 784),
45
+ (1392, 744),
46
+ (1440, 720),
47
+ (1544, 672),
48
+ (1624, 640),
49
+ (1696, 608),
50
+ (1768, 592),
51
+ ]
52
+
53
+ lora_styles = {
54
+ "None": (None, 0.0, ""),
55
+ "Foreskin play": ("kkntr/lora5", 1.2, "foreskin insertion"),
56
+ "Cum through clothing": ("kkntr/lora6", 1.2, "cum in clothing"),
57
+ "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"),
58
+ "Frottage": ("kkntr/lora8", 1.2, "byfrottage, frottage"),
59
+ "Penis towards viewer": ("kkntr/lora9", 1.2, "penis_towards_viewer"),
60
+ "Foreskin play closeup": ("kkntr/lora11", 2.0, "ZonkFS"),
61
+ }
62
+
63
+ @spaces.GPU
64
+ def generate(prompt, negative_prompt, width, height, random_res, selected_style):
65
+ if random_res:
66
+ width, height = random.choice(resolutions)
67
+
68
+ # Valitaan tyyli-LoRA ja lisätään triggeri
69
+ lora_addition = {}
70
+ if selected_style != "None" and selected_style in lora_styles:
71
+ lora_path, lora_strength, lora_trigger = lora_styles[selected_style]
72
+ prompt = f"{lora_trigger}, {prompt}"
73
+ lora_addition[lora_path] = lora_strength
74
+
75
+ # Ladataan pysyvät + tyyli-LoRA yhteen
76
+ all_loras = {
77
+ "kkntr/lora1": 0.2,
78
+ "kkntr/lora2": 0.3,
79
+ "kkntr/lora12": 0.4,
80
+ "kkntr/lora10": 0.1,
81
+ }
82
+ all_loras.update(lora_addition) # ← MUUTETTU
83
+
84
+ pipe.load_lora_weights(all_loras) # ← MUUTETTU
85
+ pipe.fuse_lora() # ← MUUTETTU
86
+
87
+
88
+ quality_suffix = (
89
+ ", (anthro), (male), (best quality), high resolution, (ultra detailed),"
90
+ " 8k, (highly detailed), (masterpiece), (sharp focus), (intricate details),"
91
+ " (perfect anatomy), (depth of field), high dynamic range,"
92
+ " (smooth shading), (realistic shadows), (rich texture),"
93
+ " professional color grading, (fine details), ultra sharp,"
94
+ " HDR, (anatomically correct), painterly realism, 20r0j_2, civifur"
95
+ )
96
+
97
+ full_prompt = prompt + quality_suffix
98
+
99
+ image = pipe(
100
+ prompt=full_prompt,
101
+ negative_prompt=negative_prompt,
102
+ width=width,
103
+ height=height,
104
+ num_inference_steps=35,
105
+ guidance_scale=7.5
106
+ ).images[0]
107
+
108
+ return image, full_prompt
109
+
110
+ gr.Interface(
111
+ fn=generate,
112
+ inputs=[
113
+ gr.Textbox(label="Prompt"),
114
+ gr.Textbox(
115
+ label="Negative Prompt",
116
+ 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"
117
+ ),
118
+ gr.Slider(minimum=512, maximum=1024, step=64, value=768, label="Width"),
119
+ gr.Slider(minimum=512, maximum=1024, step=64, value=768, label="Height"),
120
+ gr.Checkbox(label="Random resolution mode (override sliders)", value=True),
121
+ gr.Dropdown(
122
+ choices=list(lora_styles.keys()),
123
+ value="None",
124
+ label="Select Style"
125
+ )
126
+ ],
127
+ outputs=[
128
+ gr.Image(label="Generated Image"),
129
+ gr.Textbox(label="Used Prompt", lines=4)
130
+ ],
131
+ title="FURRYSTYLE",
132
+ description="Give a prompt"
133
+ ).launch()
requirements.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ torch
2
+ diffusers[torch]
3
+ transformers
4
+ accelerate
5
+ safetensors
6
+ gradio
7
+ spaces
8
+ peft