Views
No views yet

FLUX.1 Canny [dev] is 12 billion parameter rectified flow transformer capable of generating an image based on a text description while following the structure of a given input image. For more information, please read our blog post.FLUX.1 Canny [dev] more efficient.FLUX.1 [dev] Non-Commercial License.FLUX.1 Canny [dev], as well as sampling code, in a dedicated github repository.
Developers and creatives looking to build on top of FLUX.1 Canny [dev] are encouraged to use this as a starting point.FLUX.1 Canny [pro] is available in our API bfl.ml
FLUX.1-Canny-dev with the 🧨 diffusers python library, first install or upgrade diffusers and controlnet_aux.pip install -U diffusers controlnet_auxFluxControlPipeline to run the model1import torch
2from controlnet_aux import CannyDetector
3from diffusers import FluxControlPipeline
4from diffusers.utils import load_image
5
6pipe = FluxControlPipeline.from_pretrained("black-forest-labs/FLUX.1-Canny-dev", torch_dtype=torch.bfloat16).to("cuda")
7
8prompt = "A robot made of exotic candies and chocolates of different kinds. The background is filled with confetti and celebratory gifts."
9control_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/robot.png")
10
11processor = CannyDetector()
12control_image = processor(control_image, low_threshold=50, high_threshold=200, detect_resolution=1024, image_resolution=1024)
13
14image = pipe(
15 prompt=prompt,
16 control_image=control_image,
17 height=1024,
18 width=1024,
19 num_inference_steps=50,
20 guidance_scale=30.0,
21).images[0]
22image.save("output.png")FLUX.1 [dev] Non-Commercial License.