Spaces:
Running
on
Zero
Running
on
Zero
aifeifei798
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -5,24 +5,37 @@ import spaces
|
|
5 |
import torch
|
6 |
from diffusers import DiffusionPipeline, AutoencoderTiny
|
7 |
|
8 |
-
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
# device
|
13 |
-
#)
|
14 |
|
15 |
-
|
16 |
-
# "aifeifei798/DarkIdol-flux-v1", torch_dtype=dtype, vae=taef1
|
17 |
-
#).to(device)
|
18 |
-
|
19 |
-
pipe = DiffusionPipeline.from_pretrained(
|
20 |
"aifeifei798/DarkIdol-flux-v1.1", torch_dtype=dtype
|
21 |
-
).to(device)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
-
|
24 |
-
pipe.vae.
|
25 |
-
pipe.
|
|
|
|
|
|
|
|
|
26 |
|
27 |
|
28 |
MAX_SEED = np.iinfo(np.int32).max
|
|
|
5 |
import torch
|
6 |
from diffusers import DiffusionPipeline, AutoencoderTiny
|
7 |
|
8 |
+
def feifeimodload():
|
9 |
|
10 |
+
dtype = torch.bfloat16
|
11 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
|
|
12 |
|
13 |
+
pipe = DiffusionPipeline.from_pretrained(
|
|
|
|
|
|
|
|
|
14 |
"aifeifei798/DarkIdol-flux-v1.1", torch_dtype=dtype
|
15 |
+
).to(device)
|
16 |
+
|
17 |
+
pipe.load_lora_weights(
|
18 |
+
hf_hub_download("aifeifei798/flux-nsfw-lora", "Ultra-Realistic Nipple Generator_v2.safetensors"),
|
19 |
+
adapter_name="Ultra-Realistic",
|
20 |
+
)
|
21 |
+
|
22 |
+
pipe.set_adapters(
|
23 |
+
["Ultra-Realistic"],
|
24 |
+
adapter_weights=[0.75],
|
25 |
+
)
|
26 |
+
|
27 |
+
pipe.fuse_lora(
|
28 |
+
adapter_name=["Ultra-Realistic"],
|
29 |
+
lora_scale=1.0,
|
30 |
+
)
|
31 |
|
32 |
+
pipe.vae.enable_slicing()
|
33 |
+
pipe.vae.enable_tiling()
|
34 |
+
pipe.unload_lora_weights()
|
35 |
+
torch.cuda.empty_cache()
|
36 |
+
return pipe
|
37 |
+
|
38 |
+
pipe = feifeimodload()
|
39 |
|
40 |
|
41 |
MAX_SEED = np.iinfo(np.int32).max
|