Skip to content

inpainting_image_generation_engine

InpaintingImageGenerationEngine

Bases: BaseImageGenerationEngine

Source code in griptape/engines/image/inpainting_image_generation_engine.py
@define
class InpaintingImageGenerationEngine(BaseImageGenerationEngine):
    def run(
        self,
        prompts: list[str],
        *args,
        image: ImageArtifact,
        mask: ImageArtifact,
        negative_prompts: Optional[list[str]] = None,
        rulesets: Optional[list[Ruleset]] = None,
        negative_rulesets: Optional[list[Ruleset]] = None,
        **kwargs,
    ) -> ImageArtifact:
        prompts = self._ruleset_to_prompts(prompts, rulesets)
        negative_prompts = self._ruleset_to_prompts(negative_prompts, negative_rulesets)

        return self.image_generation_driver.run_image_inpainting(
            prompts,
            image=image,
            mask=mask,
            negative_prompts=negative_prompts,
        )

run(prompts, *args, image, mask, negative_prompts=None, rulesets=None, negative_rulesets=None, **kwargs)

Source code in griptape/engines/image/inpainting_image_generation_engine.py
def run(
    self,
    prompts: list[str],
    *args,
    image: ImageArtifact,
    mask: ImageArtifact,
    negative_prompts: Optional[list[str]] = None,
    rulesets: Optional[list[Ruleset]] = None,
    negative_rulesets: Optional[list[Ruleset]] = None,
    **kwargs,
) -> ImageArtifact:
    prompts = self._ruleset_to_prompts(prompts, rulesets)
    negative_prompts = self._ruleset_to_prompts(negative_prompts, negative_rulesets)

    return self.image_generation_driver.run_image_inpainting(
        prompts,
        image=image,
        mask=mask,
        negative_prompts=negative_prompts,
    )