Skip to main content

Model API

All URIs are relative to http://localhost:1000

MethodHTTP requestDescription
model_specific_model_downloadPOST /model/{model}/download/model/{model}/download [POST]
model_specific_model_download_cancelPOST /model/{model}/download/cancel/model/{model}/download/cancel [POST]
model_specific_model_download_progressGET /model/{model}/download/progress/model/{model}/download/progress [WS]
model_specific_model_loadPOST /model/{model}/load/model/{model}/load [POST]
model_specific_model_unloadPOST /model/{model}/unload/model/{model}/unload [POST]
model_updatePOST /model/update/model/update [POST]
models_specific_model_snapshotGET /model/{model}/model/{model} [GET]

model_specific_model_download

Model model_specific_model_download(model)

/model/{model}/download [POST]

Downloads a specific model to your local machine.

Example

import pieces_os_client
from pieces_os_client.models.model import Model
from pieces_os_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:1000
# See configuration.py for a list of all supported configuration parameters.
configuration = pieces_os_client.Configuration(
host="http://localhost:1000"
)


# Enter a context with an instance of the API client
with pieces_os_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pieces_os_client.ModelApi(api_client)
model = 'model_example' # str | model id

try:
# /model/\{model\}/download [POST]
api_response = api_instance.model_specific_model_download(model)
print("The response of ModelApi->model_specific_model_download:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ModelApi->model_specific_model_download: %s\n" % e)

Parameters

NameTypeDescriptionNotes
modelstrmodel id

Return type

Model

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, text/plain

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-

model_specific_model_download_cancel

Model model_specific_model_download_cancel(model)

/model/{model}/download/cancel [POST]

Cancels a specific model download that is currently in progress.

Example

import pieces_os_client
from pieces_os_client.models.model import Model
from pieces_os_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:1000
# See configuration.py for a list of all supported configuration parameters.
configuration = pieces_os_client.Configuration(
host="http://localhost:1000"
)


# Enter a context with an instance of the API client
with pieces_os_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pieces_os_client.ModelApi(api_client)
model = 'model_example' # str | model id

try:
# /model/\{model\}/download/cancel [POST]
api_response = api_instance.model_specific_model_download_cancel(model)
print("The response of ModelApi->model_specific_model_download_cancel:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ModelApi->model_specific_model_download_cancel: %s\n" % e)

Parameters

NameTypeDescriptionNotes
modelstrmodel id

Return type

Model

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, text/plain

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-

model_specific_model_download_progress

ModelDownloadProgress model_specific_model_download_progress(model)

/model/{model}/download/progress [WS]

This is a WebSocket connection that provides real-time updates on the download progress of a specific model.

Example

import pieces_os_client
from pieces_os_client.models.model_download_progress import ModelDownloadProgress
from pieces_os_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:1000
# See configuration.py for a list of all supported configuration parameters.
configuration = pieces_os_client.Configuration(
host="http://localhost:1000"
)


# Enter a context with an instance of the API client
with pieces_os_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pieces_os_client.ModelApi(api_client)
model = 'model_example' # str | model id

try:
# /model/\{model\}/download/progress [WS]
api_response = api_instance.model_specific_model_download_progress(model)
print("The response of ModelApi->model_specific_model_download_progress:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ModelApi->model_specific_model_download_progress: %s\n" % e)

Parameters

NameTypeDescriptionNotes
modelstrmodel id

Return type

ModelDownloadProgress

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, text/plain

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-

model_specific_model_load

Model model_specific_model_load(model)

/model/{model}/load [POST]

Loads a previously downloaded model into memory. It differs from downloading, as downloading involves transferring the entire model to your machine, while loading simply loads the model into memory.

Example

import pieces_os_client
from pieces_os_client.models.model import Model
from pieces_os_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:1000
# See configuration.py for a list of all supported configuration parameters.
configuration = pieces_os_client.Configuration(
host="http://localhost:1000"
)


# Enter a context with an instance of the API client
with pieces_os_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pieces_os_client.ModelApi(api_client)
model = 'model_example' # str | model id

try:
# /model/\{model\}/load [POST]
api_response = api_instance.model_specific_model_load(model)
print("The response of ModelApi->model_specific_model_load:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ModelApi->model_specific_model_load: %s\n" % e)

Parameters

NameTypeDescriptionNotes
modelstrmodel id

Return type

Model

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, text/plain

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-

model_specific_model_unload

Model model_specific_model_unload(model)

/model/{model}/unload [POST]

Unloads a previously loaded model from memory and effectively frees up the RAM consumed by the model.

Example

import pieces_os_client
from pieces_os_client.models.model import Model
from pieces_os_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:1000
# See configuration.py for a list of all supported configuration parameters.
configuration = pieces_os_client.Configuration(
host="http://localhost:1000"
)


# Enter a context with an instance of the API client
with pieces_os_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pieces_os_client.ModelApi(api_client)
model = 'model_example' # str | model id

try:
# /model/\{model\}/unload [POST]
api_response = api_instance.model_specific_model_unload(model)
print("The response of ModelApi->model_specific_model_unload:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ModelApi->model_specific_model_unload: %s\n" % e)

Parameters

NameTypeDescriptionNotes
modelstrmodel id

Return type

Model

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, text/plain

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-

model_update

Model model_update(model=model)

/model/update [POST]

Updates a machine learning model. This functionality is exclusively available for models with the 'custom:true' setting.

Example

import pieces_os_client
from pieces_os_client.models.model import Model
from pieces_os_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:1000
# See configuration.py for a list of all supported configuration parameters.
configuration = pieces_os_client.Configuration(
host="http://localhost:1000"
)


# Enter a context with an instance of the API client
with pieces_os_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pieces_os_client.ModelApi(api_client)
model = pieces_os_client.Model() # Model | (optional)

try:
# /model/update [POST]
api_response = api_instance.model_update(model=model)
print("The response of ModelApi->model_update:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ModelApi->model_update: %s\n" % e)

Parameters

NameTypeDescriptionNotes
modelModel[optional]

Return type

Model

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, text/plain

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-

models_specific_model_snapshot

Model models_specific_model_snapshot(model)

/model/{model} [GET]

Retrieves a specific ML model.

Example

import pieces_os_client
from pieces_os_client.models.model import Model
from pieces_os_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:1000
# See configuration.py for a list of all supported configuration parameters.
configuration = pieces_os_client.Configuration(
host="http://localhost:1000"
)


# Enter a context with an instance of the API client
with pieces_os_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pieces_os_client.ModelApi(api_client)
model = 'model_example' # str | model id

try:
# /model/\{model\} [GET]
api_response = api_instance.models_specific_model_snapshot(model)
print("The response of ModelApi->models_specific_model_snapshot:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ModelApi->models_specific_model_snapshot: %s\n" % e)

Parameters

NameTypeDescriptionNotes
modelstrmodel id

Return type

Model

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, text/plain

HTTP response details

Status codeDescriptionResponse headers
200OK-
410model was not found.-