pixano.inference.provider
¶
Abstract inference provider interface.
This module defines the abstract interface that all inference providers must implement. Pixano uses this interface to communicate with different backends (pixano-inference, OpenAI, Gemini, local models, etc.) in a uniform way.
InferenceProvider
¶
Bases: ABC
Abstract interface for inference backends.
This is the base class that all inference providers must implement. It defines a common interface for interacting with different inference backends, allowing Pixano to be agnostic to the specific backend used.
Example
name
abstractmethod
property
¶
Provider name (e.g., 'pixano-inference', 'openai', 'gemini').
delete_model(model_name)
async
¶
Delete (unload) a model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name
|
str
|
Name of the model to delete. |
required |
Raises:
| Type | Description |
|---|---|
TaskNotSupportedError
|
Model deployment is managed by the server administrator. |
Source code in pixano/inference/provider.py
get_capabilities()
abstractmethod
async
¶
Return what this provider can do.
Returns:
| Type | Description |
|---|---|
ProviderCapabilities
|
ProviderCapabilities describing supported tasks and features. |
get_server_info()
abstractmethod
async
¶
Get server information.
Returns:
| Type | Description |
|---|---|
ServerInfo
|
ServerInfo with version, GPU info, models, readiness. |
image_mask_generation(input_data, timeout=60.0)
abstractmethod
async
¶
Generate masks for an image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_data
|
ImageMaskGenerationInput
|
Input data for mask generation. |
required |
timeout
|
float
|
Maximum time to wait for result. |
60.0
|
Returns:
| Type | Description |
|---|---|
ImageMaskGenerationResult
|
Mask generation result. |
Source code in pixano/inference/provider.py
image_zero_shot_detection(input_data, timeout=60.0)
abstractmethod
async
¶
Detect objects in an image using zero-shot detection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_data
|
ImageZeroShotDetectionInput
|
Input data for detection. |
required |
timeout
|
float
|
Maximum time to wait for result. |
60.0
|
Returns:
| Type | Description |
|---|---|
ImageZeroShotDetectionResult
|
Detection result. |
Source code in pixano/inference/provider.py
instantiate_model(provider, config, timeout=60)
async
¶
Instantiate (load) a model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider
|
str
|
The model provider name (e.g., "sam2", "transformers"). |
required |
config
|
ModelConfig
|
Configuration for the model. |
required |
timeout
|
int
|
Timeout in seconds for model loading. |
60
|
Raises:
| Type | Description |
|---|---|
TaskNotSupportedError
|
Model deployment is managed by the server administrator. |
Source code in pixano/inference/provider.py
list_models(task=None)
abstractmethod
async
¶
List available models, optionally filtered by task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task
|
InferenceTask | None
|
Optional task to filter models by. |
None
|
Returns:
| Type | Description |
|---|---|
list[ModelInfo]
|
List of available models. |
Source code in pixano/inference/provider.py
text_image_conditional_generation(input_data, timeout=60.0)
abstractmethod
async
¶
Generate text conditioned on images.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_data
|
TextImageConditionalGenerationInput
|
Input data for text generation. |
required |
timeout
|
float
|
Maximum time to wait for result. |
60.0
|
Returns:
| Type | Description |
|---|---|
TextImageConditionalGenerationResult
|
Text generation result. |
Source code in pixano/inference/provider.py
video_mask_generation(input_data, timeout=120.0)
abstractmethod
async
¶
Generate masks for video frames.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_data
|
VideoMaskGenerationInput
|
Input data for video mask generation. |
required |
timeout
|
float
|
Maximum time to wait for result. |
120.0
|
Returns:
| Type | Description |
|---|---|
VideoMaskGenerationResult
|
Video mask generation result. |