Class: AIServerCloudZoo

AIServerCloudZoo(serverUrl, zooUrlopt, accessToken, isDummyopt)

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.

Constructor

new AIServerCloudZoo(serverUrl, zooUrlopt, accessToken, isDummyopt)

Do not call this constructor, instead use the `connect` function of the dg_sdk class to create an AIServerCloudZoo instance.
Parameters:
Name Type Attributes Default Description
serverUrl string The URL of the AI server (WebSocket URL).
zooUrl string <optional>
'https://cs.degirum.com/degirum/public' The URL of the cloud model zoo.
accessToken string The access token for the cloud zoo.
isDummy boolean <optional>
false Whether this is a dummy instance (if we only need to have model listing functionality, without connecting to an AIServer).
Source:
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 });

Methods

(async) 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
Parameters:
Name Type Description
modelName string The name of the model to download.
Source:
Returns:
The downloaded model as a Blob.
Type
Promise.<Blob>

(async) 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
Parameters:
Name Type Description
modelName string The name of the model.
Source:
Returns:
The model's label dictionary.
Type
Promise.<Object>

(async) getZoos(organization) → {Promise.<Object>}

Fetches the list of zoos for a given organization.
Parameters:
Name Type Description
organization string The name of the organization.
Source:
Returns:
The list of zoos.
Type
Promise.<Object>

(async) listModels() → {Promise.<Object>}

Lists all available models in the cloud zoo.
Source:
Returns:
An object containing the available models and their params.
Type
Promise.<Object>
Example
let models = await zoo.listModels();
let modelNames = Object.keys(models);

(async) loadModel(modelName, optionsopt) → {Promise.<AIServerModel>}

Loads a model from the cloud zoo and prepares it for inference.
Parameters:
Name Type Attributes Default Description
modelName string The name of the model to load.
options Object <optional>
{} Additional options for loading the model.
Properties
Name Type Attributes Default Description
max_q_len number <optional>
10 The maximum length of the internal inference queue.
callback function <optional>
null A callback function to handle inference results.
Source:
Returns:
The loaded model instance.
Type
Promise.<AIServerModel>
Example
let model = await zoo.loadModel('someModel', { inputCropPercentage: 0.5, callback: someFunction } ); 

(async) systemInfo() → {Promise.<Object>}

Fetches system information from the AI server.
Source:
Returns:
The system information.
Type
Promise.<Object>