List Lookout for Vision models that are currently hosted using an AWS SDK - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

List Lookout for Vision models that are currently hosted using an AWS SDK

The following code example shows how to list Lookout for Vision models that are currently hosted.

Python
SDK for Python (Boto3)
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

class Hosting: @staticmethod def list_hosted(lookoutvision_client): """ Displays a list of models in your account that are currently hosted. :param lookoutvision_client: A Boto3 Lookout for Vision client. """ try: response = lookoutvision_client.list_projects() hosted = 0 print("Hosted models\n-------------") for project in response["Projects"]: response_models = lookoutvision_client.list_models( ProjectName=project["ProjectName"] ) for model in response_models["Models"]: model_description = lookoutvision_client.describe_model( ProjectName=project["ProjectName"], ModelVersion=model["ModelVersion"], ) if model_description["ModelDescription"]["Status"] == "HOSTED": print( f"Project: {project['ProjectName']} Model version: " f"{model['ModelVersion']}" ) hosted += 1 print(f"{hosted} model(s) hosted") except ClientError: logger.exception("Problem listing hosted models.") raise