Binettebob22 commited on
Commit
bc32c80
β€’
1 Parent(s): a3892c1

Create Lactation

Browse files
Files changed (1) hide show
  1. Lactation +35 -0
Lactation ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from diffusers import DiffusionPipeline, UniPCMultistepScheduler
2
+ import torch
3
+
4
+ pipeline = DiffusionPipeline.from_pretrained(
5
+ "andite/anything-v4.0", torch_dtype=torch.float16, safety_checker=None
6
+ ).to("cuda")
7
+ pipeline.scheduler = UniPCMultistepScheduler.from_config(pipeline.scheduler.config)
8
+ # uncomment to download the safetensor weights
9
+ #!wget https://civitai.com/models/109643/real-and-animebreast-milklactationbreast-milk-drippingspraying-breast-milkgrabbing-breastsbreast-squeezenipple-pinch-and
10
+ pipeline.load_lora_weights("."spraying breast milk_SD1.5v1.safetensors")
11
+ prompt = "masterpiece, illustration, ultra-detailed, cityscape, san francisco, golden gate bridge, california, bay area, in the snow, beautiful detailed starry sky"
12
+ negative_prompt = "lowres, cropped, worst quality, low quality, normal quality, artifacts, signature, watermark, username, blurry, more than one bridge, bad architecture"
13
+
14
+ images = pipeline(
15
+ prompt=prompt,
16
+ negative_prompt=negative_prompt,
17
+ width=512,
18
+ height=512,
19
+ num_inference_steps=25,
20
+ num_images_per_prompt=4,
21
+ generator=torch.manual_seed(0),
22
+ ).images
23
+ from PIL import Image
24
+
25
+
26
+ def image_grid(imgs, rows=2, cols=2):
27
+ w, h = imgs[0].size
28
+ grid = Image.new("RGB", size=(cols * w, rows * h))
29
+
30
+ for i, img in enumerate(imgs):
31
+ grid.paste(img, box=(i % cols * w, i // cols * h))
32
+ return grid
33
+
34
+
35
+ image_grid(images)