(
context: Context,
prompt: str = "",
negative_prompt: str = "",
seed: int = 42,
width: int = 512,
height: int = 512,
num_outputs: int = 1,
num_inference_steps: int = 25,
guidance_scale: float = 7.5,
distilled_guidance_scale: float = 3.5,
init_image=None,
init_image_mask=None,
ref_images=None,
control_image=None,
control_alpha=1.0,
controlnet_filter=None,
prompt_strength: float = 0.8,
preserve_init_image_color_profile=False,
strict_mask_border=False,
sampler_name: str = "euler_a",
scheduler_name: str = "simple",
hypernetwork_strength: float = 0,
tiling=None,
lora_alpha: Union[float, List[float]] = 0,
sampler_params={},
callback=None,
output_type="pil",
)
| 168 | |
| 169 | |
| 170 | def generate_images( |
| 171 | context: Context, |
| 172 | prompt: str = "", |
| 173 | negative_prompt: str = "", |
| 174 | seed: int = 42, |
| 175 | width: int = 512, |
| 176 | height: int = 512, |
| 177 | num_outputs: int = 1, |
| 178 | num_inference_steps: int = 25, |
| 179 | guidance_scale: float = 7.5, |
| 180 | distilled_guidance_scale: float = 3.5, |
| 181 | init_image=None, |
| 182 | init_image_mask=None, |
| 183 | ref_images=None, |
| 184 | control_image=None, |
| 185 | control_alpha=1.0, |
| 186 | controlnet_filter=None, |
| 187 | prompt_strength: float = 0.8, |
| 188 | preserve_init_image_color_profile=False, |
| 189 | strict_mask_border=False, |
| 190 | sampler_name: str = "euler_a", |
| 191 | scheduler_name: str = "simple", |
| 192 | hypernetwork_strength: float = 0, |
| 193 | tiling=None, |
| 194 | lora_alpha: Union[float, List[float]] = 0, |
| 195 | sampler_params={}, |
| 196 | callback=None, |
| 197 | output_type="pil", |
| 198 | ): |
| 199 | |
| 200 | task_id = str(uuid.uuid4()) |
| 201 | |
| 202 | sampler_name = convert_ED_sampler_names(sampler_name) |
| 203 | controlnet_filter = convert_ED_controlnet_filter_name(controlnet_filter) |
| 204 | |
| 205 | cmd = { |
| 206 | "force_task_id": task_id, |
| 207 | "prompt": prompt, |
| 208 | "negative_prompt": negative_prompt, |
| 209 | "sampler_name": sampler_name, |
| 210 | "scheduler": scheduler_name, |
| 211 | "steps": num_inference_steps, |
| 212 | "seed": seed, |
| 213 | "cfg_scale": guidance_scale, |
| 214 | "distilled_cfg_scale": distilled_guidance_scale, |
| 215 | "batch_size": num_outputs, |
| 216 | "width": width, |
| 217 | "height": height, |
| 218 | } |
| 219 | |
| 220 | if init_image: |
| 221 | cmd["init_images"] = [init_image] |
| 222 | cmd["denoising_strength"] = prompt_strength |
| 223 | if init_image_mask: |
| 224 | cmd["mask"] = init_image_mask if isinstance(init_image_mask, str) else img_to_base64_str(init_image_mask) |
| 225 | cmd["include_init_images"] = True |
| 226 | cmd["inpainting_fill"] = 1 |
| 227 | cmd["initial_noise_multiplier"] = 1 |
nothing calls this directly
no test coverage detected