pixano.app.routers.inference.utils
¶
get_model_source(dataset, model)
¶
Get the model's source from a given Dataset and Model.
If it exists in the database already it returns that one otherwise creates a new instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
Dataset
|
The dataset to get/create the source in. |
required |
model
|
str
|
The model name. |
required |
Returns:
| Type | Description |
|---|---|
Source
|
The Source object for the model. |
Raises:
| Type | Description |
|---|---|
HTTPException
|
If multiple sources exist for the same model. |
Source code in pixano/app/routers/inference/utils.py
get_provider_from_settings(settings, provider_name=None)
¶
Get an inference provider from the settings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings
|
Settings
|
App settings. |
required |
provider_name
|
str | None
|
Name of the provider to get. If None, uses the default provider. |
None
|
Returns:
| Type | Description |
|---|---|
InferenceProvider
|
The requested InferenceProvider. |
Raises:
| Type | Description |
|---|---|
HTTPException
|
If no provider is connected or the requested provider is not found. |