()
| 156 | |
| 157 | |
| 158 | def example_6(): |
| 159 | model_manager = ModelManager(torch_dtype=torch.bfloat16, model_id_list=[ |
| 160 | "FLUX.1-dev", |
| 161 | "jasperai/Flux.1-dev-Controlnet-Surface-Normals", |
| 162 | "alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Beta" |
| 163 | ]) |
| 164 | pipe = FluxImagePipeline.from_model_manager(model_manager, controlnet_config_units=[ |
| 165 | ControlNetConfigUnit( |
| 166 | processor_id="inpaint", |
| 167 | model_path="models/ControlNet/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Beta/diffusion_pytorch_model.safetensors", |
| 168 | scale=0.9 |
| 169 | ), |
| 170 | ControlNetConfigUnit( |
| 171 | processor_id="normal", |
| 172 | model_path="models/ControlNet/jasperai/Flux.1-dev-Controlnet-Surface-Normals/diffusion_pytorch_model.safetensors", |
| 173 | scale=0.6 |
| 174 | ), |
| 175 | ]) |
| 176 | |
| 177 | image_1 = pipe( |
| 178 | prompt="a beautiful Asian woman looking at the sky, wearing a blue t-shirt.", |
| 179 | height=1024, width=1024, |
| 180 | seed=10 |
| 181 | ) |
| 182 | image_1.save("image_11.jpg") |
| 183 | |
| 184 | mask = np.zeros((1024, 1024, 3), dtype=np.uint8) |
| 185 | mask[-400:, 10:-40] = 255 |
| 186 | mask = Image.fromarray(mask) |
| 187 | mask.save("mask_11.jpg") |
| 188 | |
| 189 | image_2 = pipe( |
| 190 | prompt="a beautiful Asian woman looking at the sky, wearing a yellow t-shirt.", |
| 191 | controlnet_image=image_1, controlnet_inpaint_mask=mask, |
| 192 | height=1024, width=1024, |
| 193 | seed=11 |
| 194 | ) |
| 195 | image_2.save("image_12.jpg") |
| 196 | |
| 197 | |
| 198 | def example_7(): |
no test coverage detected