generate_background module#
Generate AI-enhanced images for each image in the output directory.
- generate_background.generate_background(image_file: str, mask_file: str, output_path: str, prompt: str, negative_prompt: str, device: str, pipe: <Mock name='mock.AutoPipelineForInpainting' id='140449437490224'>, object_names: tuple[str, str] | None = None) None [source]#
Generate and save an enhanced image using a diffusion model for a given image and mask.
- Parameters:
image_file – The path to the image file.
mask_file – The path to the mask file corresponding to the image.
output_path – The path to save the enhanced image.
prompt – The prompt to generate the enhanced image.
negative_prompt – The negative prompt to avoid certain features in the generated image.
device – cpu or cuda (if available).
pipe – The diffusion model.
object_names – Optional tuple of (object1, object2) names to add to the prompt.
- generate_background.initalize_diffuser(device: str) <Mock name='mock.AutoPipelineForInpainting' id='140449437490224'> [source]#
Initialize the diffusion model.
- Parameters:
device – cpu or cuda (if available).
- Returns:
The diffusion model.
- generate_background.main(prompt: str, negative_prompt: str, device: str) None [source]#
Generate enhanced images for each image in the output directory.
- Parameters:
prompt – The prompt to generate the enhanced image.
negative_prompt – The negative prompt to avoid certain features in the generated image.
device – cpu or cuda (if available).