Shortcuts

modelzoo.fastai

modelzoo.fastai.deploy(learner: fastai.learner.Learner, model_name: Optional[str] = None, resources_config: Optional[modelzoo.resources_config.ResourcesConfig] = None, api_key: Optional[str] = None, wait_until_healthy: bool = True) → None

Deploy a Fast AI Learner to your zoo.

Note

This function will serialize a model as a pickle file to a temporary directory on the filesystem before uploading it to Model Zoo.

Parameters
  • model – A fastai.learner.Learner object to deploy.

  • model_name – Optional string name of the model. If not provided, a random name will be generated. Model name must be unique across all of a user’s models.

  • resources_config – An optional modelzoo.ResourcesConfig that specifies the resources (e.g. memory, CPU) to use for the model. Defaults to modelzoo.ResourcesConfig().

  • api_key – Optional API key that, if provided, will override the API key available to the environment.

  • wait_until_healthy – If True (default), this function will refrain from returning until the model has reached a HEALTHY state.

Returns

The name of the created model.

modelzoo.fastai.predict(model_name: str, input_value: Any, api_key: Optional[str] = None) → Any

Send a prediction to a FastAI Learner.

Parameters
  • model_name – String name of the model.

  • input_value – A value to send for a prediction, e.g. a value that would be passed to model.predict(). Must be JSON-serializable.

  • api_key – Will override the environment api key, if present.

Returns

The output value returned by the model.