Fake-QRcode / README.md
ghoskno's picture
Update README.md
088292f verified
---
library_name: diffusers
license: apache-2.0
language:
- en
pipeline_tag: image-to-image
---
# Fake-QRcode ControlNet
These are ControlNet checkpoints trained on runwayml/stable-diffusion-v1-5 to generate recognizable AIGC QRcode image.
## Model Details
Details will be added soon...
## Use with diffusers
See the snippet below for usage with diffusers:
```python
import cv2
import numpy as np
import torch
import os, sys
from diffusers import StableDiffusionControlNetPipeline, ControlNetModel, AutoencoderKL, EulerAncestralDiscreteScheduler
from PIL import Image
controlnet = ControlNetModel.from_pretrained("ghoskno/Fake-Qrcode")
pipe = StableDiffusionControlNetPipeline.from_pretrained(
"runwayml/stable-diffusion-v1-5", controlnet=controlnet, torch_dtype=torch.float16
)
pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config)
pipe.enable_model_cpu_offload()
generator = torch.manual_seed(412052000)
qrcode = cv2.imread('path_to_qrcode.png')
qrcode = cv2.resize(255 - qrcode, (1024, 1024))
image = pipe(
"Blooming chinese chrysanthemum, green leaves growing wantonly, flowers, Complex patterns on the border, Masterpiece Art, Beauty, 8K, Unreal Engine",
Image.fromarray(qrcode),
generator=generator,
num_inference_steps=37,
guidance_scale=7,
controlnet_conditioning_scale=1.85
).images[0]
```
## Some examples
**input qrcode image**
<img src="./ghoskno.png" style="zoom: 33%;" />
**prompt**: Blooming chinese chrysanthemum, green leaves growing wantonly, flowers, Complex patterns on the border, Masterpiece Art, Beauty, 8K, Unreal Engine
<img src="./1.jpg" style="zoom: 33%;" />
**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
<img src="./2.jpg" style="zoom: 33%;" />
## Limitations and Bias
- No strict control by input prompt
- Sometimes generate confusion or generate unrecognizable QRcode images