Skip to content

Base image generation model driver

BaseImageGenerationModelDriver

Bases: SerializableMixin, ABC

Source code in griptape/drivers/image_generation_model/base_image_generation_model_driver.py
@define
class BaseImageGenerationModelDriver(SerializableMixin, ABC):
    @abstractmethod
    def get_generated_image(self, response: dict) -> bytes: ...

    @abstractmethod
    def text_to_image_request_parameters(
        self,
        prompts: list[str],
        image_width: int,
        image_height: int,
        negative_prompts: Optional[list[str]] = None,
        seed: Optional[int] = None,
    ) -> dict[str, Any]: ...

    @abstractmethod
    def image_variation_request_parameters(
        self,
        prompts: list[str],
        image: ImageArtifact,
        negative_prompts: Optional[list[str]] = None,
        seed: Optional[int] = None,
    ) -> dict[str, Any]: ...

    @abstractmethod
    def image_inpainting_request_parameters(
        self,
        prompts: list[str],
        image: ImageArtifact,
        mask: ImageArtifact,
        negative_prompts: Optional[list[str]] = None,
        seed: Optional[int] = None,
    ) -> dict[str, Any]: ...

    @abstractmethod
    def image_outpainting_request_parameters(
        self,
        prompts: list[str],
        image: ImageArtifact,
        mask: ImageArtifact,
        negative_prompts: Optional[list[str]] = None,
        seed: Optional[int] = None,
    ) -> dict[str, Any]: ...

get_generated_image(response) abstractmethod

Source code in griptape/drivers/image_generation_model/base_image_generation_model_driver.py
@abstractmethod
def get_generated_image(self, response: dict) -> bytes: ...

image_inpainting_request_parameters(prompts, image, mask, negative_prompts=None, seed=None) abstractmethod

Source code in griptape/drivers/image_generation_model/base_image_generation_model_driver.py
@abstractmethod
def image_inpainting_request_parameters(
    self,
    prompts: list[str],
    image: ImageArtifact,
    mask: ImageArtifact,
    negative_prompts: Optional[list[str]] = None,
    seed: Optional[int] = None,
) -> dict[str, Any]: ...

image_outpainting_request_parameters(prompts, image, mask, negative_prompts=None, seed=None) abstractmethod

Source code in griptape/drivers/image_generation_model/base_image_generation_model_driver.py
@abstractmethod
def image_outpainting_request_parameters(
    self,
    prompts: list[str],
    image: ImageArtifact,
    mask: ImageArtifact,
    negative_prompts: Optional[list[str]] = None,
    seed: Optional[int] = None,
) -> dict[str, Any]: ...

image_variation_request_parameters(prompts, image, negative_prompts=None, seed=None) abstractmethod

Source code in griptape/drivers/image_generation_model/base_image_generation_model_driver.py
@abstractmethod
def image_variation_request_parameters(
    self,
    prompts: list[str],
    image: ImageArtifact,
    negative_prompts: Optional[list[str]] = None,
    seed: Optional[int] = None,
) -> dict[str, Any]: ...

text_to_image_request_parameters(prompts, image_width, image_height, negative_prompts=None, seed=None) abstractmethod

Source code in griptape/drivers/image_generation_model/base_image_generation_model_driver.py
@abstractmethod
def text_to_image_request_parameters(
    self,
    prompts: list[str],
    image_width: int,
    image_height: int,
    negative_prompts: Optional[list[str]] = None,
    seed: Optional[int] = None,
) -> dict[str, Any]: ...