generate_background module

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='140390611187312'>) 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.

  • device – cpu or cuda (if available).

  • pipe – The diffusion model.

generate_background.initalize_diffuser(device: str) <Mock name='mock.AutoPipelineForInpainting' id='140390611187312'>[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.

  • device – cpu or cuda (if available).