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

Function example_2

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

Source from the content-addressed store, hash-verified

34
35
36def example_2():
37 model_manager = ModelManager(torch_dtype=torch.bfloat16, model_id_list=["FLUX.1-dev", "jasperai/Flux.1-dev-Controlnet-Upscaler"])
38 pipe = FluxImagePipeline.from_model_manager(model_manager, controlnet_config_units=[
39 ControlNetConfigUnit(
40 processor_id="tile",
41 model_path="models/ControlNet/jasperai/Flux.1-dev-Controlnet-Upscaler/diffusion_pytorch_model.safetensors",
42 scale=0.7
43 ),
44 ])
45
46 image_1 = pipe(
47 prompt="a beautiful Chinese girl, delicate skin texture",
48 height=768, width=768,
49 seed=2
50 )
51 image_1.save("image_3.jpg")
52
53 image_2 = pipe(
54 prompt="a beautiful Chinese girl, delicate skin texture",
55 controlnet_image=image_1.resize((2048, 2048)),
56 input_image=image_1.resize((2048, 2048)), denoising_strength=0.99,
57 height=2048, width=2048, tiled=True,
58 seed=3
59 )
60 image_2.save("image_4.jpg")
61
62
63def example_3():

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