如何让自己做的博客网站上线,下载做ppt的动画片的好网站,iis 搭建网站,东莞建设银行官方网站StableDiffusionDepth2ImgPipeline允许传递文本提示和初始图像#xff0c;以调节新图像的生成。此外#xff0c;还可以传递depth_map以保留图像结构。如果没有提供depth_map#xff0c;则管道通过集成的深度估计模型自动预测深度。
# 以下代码为程序运行进行设置
import o…StableDiffusionDepth2ImgPipeline允许传递文本提示和初始图像以调节新图像的生成。此外还可以传递depth_map以保留图像结构。如果没有提供depth_map则管道通过集成的深度估计模型自动预测深度。
# 以下代码为程序运行进行设置
import os
os.environ[HF_ENDPOINT] https://hf-mirror.com
mport torch
from diffusers import StableDiffusionDepth2ImgPipeline
from diffusers.utils import load_image, make_image_grid# 以下代码加载StableDiffusionDepth2ImgPipeline并创建实例 pipeline StableDiffusionDepth2ImgPipeline.from_pretrained( stabilityai/stable-diffusion-2-depth, torch_dtypetorch.float16, use_safetensorsTrue, ).to(cuda) # 以下代码加载原始图片
url http://images.cocodataset.org/val2017/000000039769.jpg
init_image load_image(url) # 以下代码由提示词及原始图片生成图片
prompt two tigers negative_prompt bad, deformed, ugly, bad anatomy image pipeline(promptprompt, imageinit_image, negative_promptnegative_prompt, strength0.7).images[0] image.show() 以下是原始图片 以下是由提示词并分析原始图片的深度生成的图片 AIGC应用44