Skip to content

pixano_inference.models.base

Base class for inference models.

BaseInferenceModel(name, provider)

Bases: ABC

Base class for inference models.

Parameters:

Name Type Description Default
name str

Name of the model.

required
provider str

Provider of the model.

required
Source code in pixano_inference/models/base.py
def __init__(self, name: str, provider: str):
    """Initialize the model.

    Args:
        name: Name of the model.
        provider: Provider of the model.
    """
    self.name = name
    self.provider = provider
    self._status = ModelStatus.IDLE

metadata abstractmethod property

Return the metadata of the model.

status property writable

Get the status of the model.

delete() abstractmethod

Delete the model.

Source code in pixano_inference/models/base.py
@abstractmethod
def delete(self):
    """Delete the model."""
    ...

image_mask_generation(*args, **kwargs)

Generate a mask from the image.

Source code in pixano_inference/models/base.py
def image_mask_generation(self, *args: Any, **kwargs) -> ImageMaskGenerationOutput:
    """Generate a mask from the image."""
    raise NotImplementedError("This model does not support image mask generation.")

image_zero_shot_detection(*args, **kwargs)

Perform zero shot detection on an image.

Source code in pixano_inference/models/base.py
def image_zero_shot_detection(self, *args: Any, **kwargs) -> ImageZeroShotDetectionOutput:
    """Perform zero shot detection on an image."""
    raise NotImplementedError("This model does not support image zero shot detection.")

text_image_conditional_generation(*args, **kwargs)

Generate text from an image and a prompt.

Source code in pixano_inference/models/base.py
def text_image_conditional_generation(self, *args: Any, **kwargs) -> TextImageConditionalGenerationOutput:
    """Generate text from an image and a prompt."""
    raise NotImplementedError("This model does not support text-image conditional generation.")

video_mask_generation(*args, **kwargs)

Generate a mask from the video.

Source code in pixano_inference/models/base.py
def video_mask_generation(self, *args: Any, **kwargs) -> VideoMaskGenerationOutput:
    """Generate a mask from the video."""
    raise NotImplementedError("This model does not support video mask generation.")

ModelStatus

Bases: Enum

Current status of the model.

Attributes: - IDLE: waiting for an input. - RUNNING: computing.