Skip to content

Aiservercloudzoo

AIServerCloudZoo

This class is responsible for managing and loading models from a cloud-based AI model zoo for inference on an AIServer. It handles model discovery, fetching model information, and loading models for use. Use loadModel() to instantiate and configure a model for use. Various utility functions are available to interact with the cloud zoo and AIServer.

Kind: global class

new AIServerCloudZoo(serverUrl, [zooUrl], accessToken, [isDummy])

Do not call this constructor, instead use the connect function of the dg_sdk class to create an AIServerCloudZoo instance.

Param Type Default Description
serverUrl string The URL of the AI server (WebSocket URL).
[zooUrl] string "'https://cs.degirum.com/degirum/public'" The URL of the cloud model zoo.
accessToken string The access token for the cloud zoo.
[isDummy] boolean false Whether this is a dummy instance (if we only need to have model listing functionality, without connecting to an AIServer).

Example (Usage:)

let zoo = dg.connect('ws://localhost:8779', 'https://cs.degirum.com/degirum/public', secretToken);
let model = await zoo.loadModel('someModel', { max_q_len: 5, callback: someFunction });

aiServerCloudZoo.getZoos(organization) ⇒ Promise.<Object>

Fetches the list of zoos for a given organization.

Kind: instance method of AIServerCloudZoo
Returns: Promise.<Object> - The list of zoos.

Param Type Description
organization string The name of the organization.

aiServerCloudZoo.getModelLabels(modelName) ⇒ Promise.<Object>

Fetches the labels for a specific model from the cloud zoo. queries https://cs.degirum.com/zoo/v1/public/models/degirum/public/example_model/dictionary

Kind: instance method of AIServerCloudZoo
Returns: Promise.<Object> - The model's label dictionary.

Param Type Description
modelName string The name of the model.

aiServerCloudZoo.systemInfo() ⇒ Promise.<Object>

Fetches system information from the AI server.

Kind: instance method of AIServerCloudZoo
Returns: Promise.<Object> - The system information.

aiServerCloudZoo.downloadModel(modelName) ⇒ Promise.<Blob>

Downloads a model from the cloud zoo. fetches from https://cs.degirum.com/zoo/v1/public/models/degirum/public/example_model

Kind: instance method of AIServerCloudZoo
Returns: Promise.<Blob> - The downloaded model as a Blob.

Param Type Description
modelName string The name of the model to download.

aiServerCloudZoo.listModels() ⇒ Promise.<Object>

Lists all available models in the cloud zoo.

Kind: instance method of AIServerCloudZoo
Returns: Promise.<Object> - An object containing the available models and their params.
Example

let models = await zoo.listModels();
let modelNames = Object.keys(models);

aiServerCloudZoo.loadModel(modelName, [options]) ⇒ Promise.<AIServerModel>

Loads a model from the cloud zoo and prepares it for inference.

Kind: instance method of AIServerCloudZoo
Returns: Promise.<AIServerModel> - The loaded model instance.

Param Type Default Description
modelName string The name of the model to load.
[options] Object {} Additional options for loading the model.
[options.max_q_len] number 10 The maximum length of the internal inference queue.
[options.callback] function A callback function to handle inference results.

Example

let model = await zoo.loadModel('someModel', { inputCropPercentage: 0.5, callback: someFunction } );