
# Chinese Latent Diffusion Model

我们开源了适配模型 `alibaba-pai/pai-diffusion-general-large-zh` 的 ControlNet，输入图像的 Canny 特征，进行可控的生成。

* Github: [EasyNLP](https://github.com/alibaba/EasyNLP)

```python
from diffusers import StableDiffusionControlNetPipeline, ControlNetModel
from PIL import Image
import numpy as np
import cv2


def to_canny(image):
    low_threshold = 100
    high_threshold = 200
    image = np.array(image)
    image = cv2.Canny(image, low_threshold, high_threshold)
    image = image[:, :, None]
    image = np.concatenate([image, image, image], axis=2)
    image = Image.fromarray(image)
    return image

controlnet_id = "alibaba-pai/pai-diffusion-general-large-zh-controlnet-canny"
controlnet = ControlNetModel.from_pretrained(controlnet_id)
model_id = "alibaba-pai/pai-diffusion-general-large-zh"
pipe = StableDiffusionControlNetPipeline.from_pretrained(model_id, controlnet=controlnet)
pipe = pipe.to("cuda")

image = Image.open("bird.png")
image_canny = to_canny(image)
prompt = "白色羽毛的小鸟"
image = pipe(prompt, image_canny).images[0]
image.save("result.png")
```
{"license": "apache-2.0", "tags": ["pytorch", "diffusers", "text-to-image"]}
diffusers pytorch text-to-image license:apache-2.0 diffusers:ControlNetModel region:us
TAGS
#diffusers #pytorch #text-to-image #license-apache-2.0 #diffusers-ControlNetModel #region-us 


# Chinese Latent Diffusion Model

我们开源了适配模型 'alibaba-pai/pai-diffusion-general-large-zh' 的 ControlNet，输入图像的 Canny 特征，进行可控的生成。

* Github: EasyNLP


# Chinese Latent Diffusion Model

我们开源了适配模型 'alibaba-pai/pai-diffusion-general-large-zh' 的 ControlNet，输入图像的 Canny 特征，进行可控的生成。

* Github: EasyNLP
TAGS
#diffusers #pytorch #text-to-image #license-apache-2.0 #diffusers-ControlNetModel #region-us 
 # Chinese Latent Diffusion Model

我们开源了适配模型 'alibaba-pai/pai-diffusion-general-large-zh' 的 ControlNet，输入图像的 Canny 特征，进行可控的生成。

* Github: EasyNLP
TAGS
#diffusers #pytorch #text-to-image #license-apache-2.0 #diffusers-ControlNetModel #region-us 
# Chinese Latent Diffusion Model

我们开源了适配模型 'alibaba-pai/pai-diffusion-general-large-zh' 的 ControlNet，输入图像的 Canny 特征，进行可控的生成。

* Github: EasyNLP