aifeifei798 commited on
Commit
3c28822
·
verified ·
1 Parent(s): 44ba5bd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -14
app.py CHANGED
@@ -5,24 +5,37 @@ import spaces
5
  import torch
6
  from diffusers import DiffusionPipeline, AutoencoderTiny
7
 
8
- dtype = torch.bfloat16
9
 
10
- device = "cuda" if torch.cuda.is_available() else "cpu"
11
- #taef1 = AutoencoderTiny.from_pretrained("aifeifei798/taef1", torch_dtype=dtype).to(
12
- # device
13
- #)
14
 
15
- #pipe = DiffusionPipeline.from_pretrained(
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
- # Enable VAE big pic
24
- pipe.vae.enable_slicing()
25
- pipe.vae.enable_tiling()
 
 
 
 
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