This is a custom block designed to extract depth maps from input images using the
Depth Anything Model
model. The model can be used as a processor to generate conditioning images for ControlNets.
How to use
import torch
from diffusers.modular_pipelines import ModularPipelineBlocks, SequentialPipelineBlocks
from diffusers.modular_pipelines.stable_diffusion_xl import TEXT2IMAGE_BLOCKS, CONTROLNET_BLOCKS
from diffusers.utils import load_image
# fetch the depth processor block that will create our depth map
depth_processor_block = ModularPipelineBlocks.from_pretrained("diffusers/depth-processor-custom-block", trust_remote_code=true)
my_blocks = TEXT2IMAGE_BLOCKS.copy()
my_blocks.insert("depth_processor", depth_processor_block, 1)
# replace text to image denoise block with controlnet denoise block
my_blocks.sub_blocks["denoise"] = CONTROLNET_BLOCKS["denoise"]
# create our initial set of controlnet blocks
blocks = SequentialPipelineBlocks.from_blocks_dict(my_blocks)
repo_id = "diffusers/modular-stable-diffusion-xl-base-1.0"# Initialize the pipeline object we can use to run our blocks
pipe = blocks.init_pipeline(repo_id)
# Load model component weights
pipe.load_components(torch_dtype=torch.float16, device_map="cuda")
image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg?download=true")
image = image.resize((1024, 1024))
prompt = ["A red car"]
output = pipe(
prompt=prompt,
image=image,
num_inference_steps=35,
guidance_scale=7.5,
output_type="pil",
)
Runs of diffusers depth-processor-custom-block on huggingface.co
0
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs
More Information About depth-processor-custom-block huggingface.co Model
depth-processor-custom-block huggingface.co
depth-processor-custom-block huggingface.co is an AI model on huggingface.co that provides depth-processor-custom-block's model effect (), which can be used instantly with this diffusers depth-processor-custom-block model. huggingface.co supports a free trial of the depth-processor-custom-block model, and also provides paid use of the depth-processor-custom-block. Support call depth-processor-custom-block model through api, including Node.js, Python, http.
depth-processor-custom-block huggingface.co is an online trial and call api platform, which integrates depth-processor-custom-block's modeling effects, including api services, and provides a free online trial of depth-processor-custom-block, you can try depth-processor-custom-block online for free by clicking the link below.
diffusers depth-processor-custom-block online free url in huggingface.co:
depth-processor-custom-block is an open source model from GitHub that offers a free installation service, and any user can find depth-processor-custom-block on GitHub to install. At the same time, huggingface.co provides the effect of depth-processor-custom-block install, users can directly use depth-processor-custom-block installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
depth-processor-custom-block install url in huggingface.co: