MCPcopy Index your code
hub / github.com/modelscope/DiffSynth-Studio / example_1

Function example_1

examples/ControlNet/flux_controlnet.py:8–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6
7
8def example_1():
9 model_manager = ModelManager(torch_dtype=torch.bfloat16, model_id_list=["FLUX.1-dev", "jasperai/Flux.1-dev-Controlnet-Upscaler"])
10 pipe = FluxImagePipeline.from_model_manager(model_manager, controlnet_config_units=[
11 ControlNetConfigUnit(
12 processor_id="tile",
13 model_path="models/ControlNet/jasperai/Flux.1-dev-Controlnet-Upscaler/diffusion_pytorch_model.safetensors",
14 scale=0.7
15 ),
16 ])
17
18 image_1 = pipe(
19 prompt="a photo of a cat, highly detailed",
20 height=768, width=768,
21 seed=0
22 )
23 image_1.save("image_1.jpg")
24
25 image_2 = pipe(
26 prompt="a photo of a cat, highly detailed",
27 controlnet_image=image_1.resize((2048, 2048)),
28 input_image=image_1.resize((2048, 2048)), denoising_strength=0.99,
29 height=2048, width=2048, tiled=True,
30 seed=1
31 )
32 image_2.save("image_2.jpg")
33
34
35

Callers 1

flux_controlnet.pyFile · 0.70

Calls 4

ModelManagerClass · 0.90
saveMethod · 0.80
from_model_managerMethod · 0.45

Tested by

no test coverage detected