Update README.md
Browse filesAdd usage example
README.md
CHANGED
|
@@ -13,6 +13,52 @@ These are ControlNet checkpoints trained on runwayml/stable-diffusion-v1-5 to ge
|
|
| 13 |
## Model Details
|
| 14 |
Details will be added soon...
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
## Limitations and Bias
|
| 18 |
|
|
|
|
| 13 |
## Model Details
|
| 14 |
Details will be added soon...
|
| 15 |
|
| 16 |
+
## Use with diffusers
|
| 17 |
+
|
| 18 |
+
See the snippet below for usage with diffusers:
|
| 19 |
+
```python
|
| 20 |
+
import cv2
|
| 21 |
+
import numpy as np
|
| 22 |
+
import torch
|
| 23 |
+
import os, sys
|
| 24 |
+
|
| 25 |
+
from diffusers import StableDiffusionControlNetPipeline, ControlNetModel, AutoencoderKL, EulerAncestralDiscreteScheduler
|
| 26 |
+
from PIL import Image
|
| 27 |
+
|
| 28 |
+
controlnet = ControlNetModel.from_pretrained("ghoskno/Fake-Qrcode")
|
| 29 |
+
pipe = StableDiffusionControlNetPipeline.from_pretrained(
|
| 30 |
+
"runwayml/stable-diffusion-v1-5", controlnet=controlnet, torch_dtype=torch.float16
|
| 31 |
+
)
|
| 32 |
+
pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config)
|
| 33 |
+
pipe.enable_model_cpu_offload()
|
| 34 |
+
|
| 35 |
+
generator = torch.manual_seed(412052000)
|
| 36 |
+
|
| 37 |
+
qrcode = cv2.imread('path_to_qrcode.png')
|
| 38 |
+
qrcode = cv2.resize(255 - qrcode, (1024, 1024))
|
| 39 |
+
|
| 40 |
+
image = pipe(
|
| 41 |
+
"Blooming chinese chrysanthemum, green leaves growing wantonly, flowers, Complex patterns on the border, Masterpiece Art, Beauty, 8K, Unreal Engine",
|
| 42 |
+
Image.fromarray(qrcode),
|
| 43 |
+
generator=generator,
|
| 44 |
+
num_inference_steps=37,
|
| 45 |
+
guidance_scale=7,
|
| 46 |
+
controlnet_conditioning_scale=1.85
|
| 47 |
+
).images[0]
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
## Some examples
|
| 51 |
+
|
| 52 |
+
**input qrcode image**
|
| 53 |
+
<img src="./ghoskno.png" style="zoom: 33%;" />
|
| 54 |
+
|
| 55 |
+
**prompt**: Blooming chinese chrysanthemum, green leaves growing wantonly, flowers, Complex patterns on the border, Masterpiece Art, Beauty, 8K, Unreal Engine
|
| 56 |
+
|
| 57 |
+
<img src="./1.jpg" style="zoom: 33%;" />
|
| 58 |
+
|
| 59 |
+
**prompt**: Plum blossoms in the snow, pink stamens, green leaves and branches growing wantonly, flowers, Complex patterns on the border, Masterpiece Art, Beauty, 8K, Unreal Engine
|
| 60 |
+
|
| 61 |
+
<img src="./2.jpg" style="zoom: 33%;" />
|
| 62 |
|
| 63 |
## Limitations and Bias
|
| 64 |
|