xinsir / controlnet-depth-sdxl-1.0

huggingface.co
Total runs: 21.9K
24-hour runs: 342
7-day runs: 1.5K
30-day runs: 2.9K
Model's Last Updated: July 09 2024
text-to-image

Introduction of controlnet-depth-sdxl-1.0

Model Details of controlnet-depth-sdxl-1.0

ControlNet Depth SDXL, support zoe, midias

images

Example

images_0)

images_1)

images_2)

images_3)

images_4)

images_5)

images_6)

images_7)

images_8)

images_9)

How to use it

from diffusers import ControlNetModel, StableDiffusionXLControlNetPipeline, AutoencoderKL
from diffusers import DDIMScheduler, EulerAncestralDiscreteScheduler
from PIL import Image
import torch
import random
import numpy as np
import cv2


from controlnet_aux import MidasDetector, ZoeDetector


processor_zoe = ZoeDetector.from_pretrained("lllyasviel/Annotators")
processor_midas = MidasDetector.from_pretrained("lllyasviel/Annotators")


controlnet_conditioning_scale = 1.0  
prompt = "your prompt, the longer the better, you can describe it as detail as possible"
negative_prompt = 'longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality'

eulera_scheduler = EulerAncestralDiscreteScheduler.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", subfolder="scheduler")


controlnet = ControlNetModel.from_pretrained(
    "xinsir/controlnet-depth-sdxl-1.0",
    torch_dtype=torch.float16
)

# when test with other base model, you need to change the vae also.
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)

pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
    "stabilityai/stable-diffusion-xl-base-1.0",
    controlnet=controlnet,
    vae=vae,
    safety_checker=None,
    torch_dtype=torch.float16,
    scheduler=eulera_scheduler,
)

# need to resize the image resolution to 1024 * 1024 or same bucket resolution to get the best performance

img = cv2.imread("your original image path")

if random.random() > 0.5:
    controlnet_img = processor_zoe(img, output_type='cv2')
else:
    controlnet_img = processor_midas(img, output_type='cv2')


height, width, _  = controlnet_img.shape
ratio = np.sqrt(1024. * 1024. / (width * height))
new_width, new_height = int(width * ratio), int(height * ratio)
controlnet_img = cv2.resize(controlnet_img, (new_width, new_height))
controlnet_img = Image.fromarray(controlnet_img)


images = pipe(
    prompt,
    negative_prompt=negative_prompt,
    image=controlnet_img,
    controlnet_conditioning_scale=controlnet_conditioning_scale,
    width=new_width,
    height=new_height,
    num_inference_steps=30,
    ).images

images[0].save(f"your image save path, png format is usually better than jpg or webp in terms of image quality but got much bigger")

Runs of xinsir controlnet-depth-sdxl-1.0 on huggingface.co

21.9K
Total runs
342
24-hour runs
613
3-day runs
1.5K
7-day runs
2.9K
30-day runs

More Information About controlnet-depth-sdxl-1.0 huggingface.co Model

More controlnet-depth-sdxl-1.0 license Visit here:

https://choosealicense.com/licenses/apache-2.0

controlnet-depth-sdxl-1.0 huggingface.co

controlnet-depth-sdxl-1.0 huggingface.co is an AI model on huggingface.co that provides controlnet-depth-sdxl-1.0's model effect (), which can be used instantly with this xinsir controlnet-depth-sdxl-1.0 model. huggingface.co supports a free trial of the controlnet-depth-sdxl-1.0 model, and also provides paid use of the controlnet-depth-sdxl-1.0. Support call controlnet-depth-sdxl-1.0 model through api, including Node.js, Python, http.

controlnet-depth-sdxl-1.0 huggingface.co Url

https://huggingface.co/xinsir/controlnet-depth-sdxl-1.0

xinsir controlnet-depth-sdxl-1.0 online free

controlnet-depth-sdxl-1.0 huggingface.co is an online trial and call api platform, which integrates controlnet-depth-sdxl-1.0's modeling effects, including api services, and provides a free online trial of controlnet-depth-sdxl-1.0, you can try controlnet-depth-sdxl-1.0 online for free by clicking the link below.

xinsir controlnet-depth-sdxl-1.0 online free url in huggingface.co:

https://huggingface.co/xinsir/controlnet-depth-sdxl-1.0

controlnet-depth-sdxl-1.0 install

controlnet-depth-sdxl-1.0 is an open source model from GitHub that offers a free installation service, and any user can find controlnet-depth-sdxl-1.0 on GitHub to install. At the same time, huggingface.co provides the effect of controlnet-depth-sdxl-1.0 install, users can directly use controlnet-depth-sdxl-1.0 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

controlnet-depth-sdxl-1.0 install url in huggingface.co:

https://huggingface.co/xinsir/controlnet-depth-sdxl-1.0

Url of controlnet-depth-sdxl-1.0

controlnet-depth-sdxl-1.0 huggingface.co Url

Provider of controlnet-depth-sdxl-1.0 huggingface.co

xinsir
ORGANIZATIONS

Other API from xinsir