Spaces:
Runtime error
Runtime error
Download Lactation from Binettebob22/fast_diffusion2: direct link, hf CLI and curl.
- Browser
- Download file 1.4 kB
-
https://huggingface.co/spaces/Binettebob22/fast_diffusion2/resolve/main/Lactation
- Command line
-
hf download hf://spaces/Binettebob22/fast_diffusion2/Lactation
-
curl -L -o Lactation https://huggingface.co/spaces/Binettebob22/fast_diffusion2/resolve/main/Lactation
1.4 kB
| from diffusers import DiffusionPipeline, UniPCMultistepScheduler | |
| import torch | |
| pipeline = DiffusionPipeline.from_pretrained( | |
| "andite/anything-v4.0", torch_dtype=torch.float16, safety_checker=None | |
| ).to("cuda") | |
| pipeline.scheduler = UniPCMultistepScheduler.from_config(pipeline.scheduler.config) | |
| # uncomment to download the safetensor weights | |
| #!wget https://civitai.com/models/109643/real-and-animebreast-milklactationbreast-milk-drippingspraying-breast-milkgrabbing-breastsbreast-squeezenipple-pinch-and | |
| pipeline.load_lora_weights("."spraying breast milk_SD1.5v1.safetensors") | |
| prompt = "masterpiece, illustration, ultra-detailed, cityscape, san francisco, golden gate bridge, california, bay area, in the snow, beautiful detailed starry sky" | |
| negative_prompt = "lowres, cropped, worst quality, low quality, normal quality, artifacts, signature, watermark, username, blurry, more than one bridge, bad architecture" | |
| images = pipeline( | |
| prompt=prompt, | |
| negative_prompt=negative_prompt, | |
| width=512, | |
| height=512, | |
| num_inference_steps=25, | |
| num_images_per_prompt=4, | |
| generator=torch.manual_seed(0), | |
| ).images | |
| from PIL import Image | |
| def image_grid(imgs, rows=2, cols=2): | |
| w, h = imgs[0].size | |
| grid = Image.new("RGB", size=(cols * w, rows * h)) | |
| for i, img in enumerate(imgs): | |
| grid.paste(img, box=(i % cols * w, i // cols * h)) | |
| return grid | |
| image_grid(images) |