获取数据集(Beta 版)

从给定的 Google Cloud 项目中获取数据集。

代码示例

Python

如需了解如何安装和使用 Data Labeling Service 客户端库,请参阅 Data Labeling Service 客户端库。如需了解详情,请参阅 Data Labeling Service Python API 参考文档

如需向 Data Labeling Service 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证

def get_dataset(dataset_resource_name):
    """Gets a dataset for the given Google Cloud project."""
    from google.cloud import datalabeling_v1beta1 as datalabeling

    client = datalabeling.DataLabelingServiceClient()

    response = client.get_dataset(request={"name": dataset_resource_name})

    print(f"The dataset resource name: {response.name}\n")
    print(f"Display name: {response.display_name}")
    print(f"Description: {response.description}")
    print("Create time:")
    print(f"\tseconds: {response.create_time.timestamp_pb().seconds}")
    print(f"\tnanos: {response.create_time.timestamp_pb().nanos}")

后续步骤

如需搜索和过滤其他 Google Cloud 产品的代码示例,请参阅 Google Cloud 示例浏览器