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

Function example_4

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

Source from the content-addressed store, hash-verified

92
93
94def example_4():
95 model_manager = ModelManager(torch_dtype=torch.bfloat16, model_id_list=["FLUX.1-dev", "InstantX/FLUX.1-dev-Controlnet-Union-alpha"])
96 pipe = FluxImagePipeline.from_model_manager(model_manager, controlnet_config_units=[
97 ControlNetConfigUnit(
98 processor_id="canny",
99 model_path="models/ControlNet/InstantX/FLUX.1-dev-Controlnet-Union-alpha/diffusion_pytorch_model.safetensors",
100 scale=0.3
101 ),
102 ControlNetConfigUnit(
103 processor_id="depth",
104 model_path="models/ControlNet/InstantX/FLUX.1-dev-Controlnet-Union-alpha/diffusion_pytorch_model.safetensors",
105 scale=0.3
106 ),
107 ])
108
109 image_1 = pipe(
110 prompt="a beautiful Asian girl, full body, red dress, summer",
111 height=1024, width=1024,
112 seed=6
113 )
114 image_1.save("image_7.jpg")
115
116 image_2 = pipe(
117 prompt="a beautiful Asian girl, full body, red dress, winter",
118 controlnet_image=image_1,
119 height=1024, width=1024,
120 seed=7
121 )
122 image_2.save("image_8.jpg")
123
124
125

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