Search in sources :

Example 1 with ImportDataConfig

use of com.google.cloud.aiplatform.v1.ImportDataConfig in project java-aiplatform by googleapis.

the class ImportDataImageObjectDetectionSample method importDataImageObjectDetectionSample.

static void importDataImageObjectDetectionSample(String project, String datasetId, String gcsSourceUri) throws IOException, InterruptedException, ExecutionException, TimeoutException {
    DatasetServiceSettings datasetServiceSettings = DatasetServiceSettings.newBuilder().setEndpoint("us-central1-aiplatform.googleapis.com:443").build();
    // the "close" method on the client to safely clean up any remaining background resources.
    try (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create(datasetServiceSettings)) {
        String location = "us-central1";
        String importSchemaUri = "gs://google-cloud-aiplatform/schema/dataset/ioformat/" + "image_bounding_box_io_format_1.0.0.yaml";
        GcsSource.Builder gcsSource = GcsSource.newBuilder();
        gcsSource.addUris(gcsSourceUri);
        DatasetName datasetName = DatasetName.of(project, location, datasetId);
        List<ImportDataConfig> importDataConfigList = Collections.singletonList(ImportDataConfig.newBuilder().setGcsSource(gcsSource).setImportSchemaUri(importSchemaUri).build());
        OperationFuture<ImportDataResponse, ImportDataOperationMetadata> importDataResponseFuture = datasetServiceClient.importDataAsync(datasetName, importDataConfigList);
        System.out.format("Operation name: %s\n", importDataResponseFuture.getInitialFuture().get().getName());
        System.out.println("Waiting for operation to finish...");
        ImportDataResponse importDataResponse = importDataResponseFuture.get(300, TimeUnit.SECONDS);
        System.out.format("Import Data Image Object Detection Response: %s\n", importDataResponse.toString());
    }
}
Also used : ImportDataResponse(com.google.cloud.aiplatform.v1.ImportDataResponse) GcsSource(com.google.cloud.aiplatform.v1.GcsSource) ImportDataConfig(com.google.cloud.aiplatform.v1.ImportDataConfig) DatasetServiceSettings(com.google.cloud.aiplatform.v1.DatasetServiceSettings) DatasetName(com.google.cloud.aiplatform.v1.DatasetName) DatasetServiceClient(com.google.cloud.aiplatform.v1.DatasetServiceClient) ImportDataOperationMetadata(com.google.cloud.aiplatform.v1.ImportDataOperationMetadata)

Example 2 with ImportDataConfig

use of com.google.cloud.aiplatform.v1.ImportDataConfig in project java-aiplatform by googleapis.

the class ImportDataTextClassificationSingleLabelSample method importDataTextClassificationSingleLabelSample.

static void importDataTextClassificationSingleLabelSample(String project, String datasetId, String gcsSourceUri) throws IOException, InterruptedException, ExecutionException, TimeoutException {
    DatasetServiceSettings datasetServiceSettings = DatasetServiceSettings.newBuilder().setEndpoint("us-central1-aiplatform.googleapis.com:443").build();
    // the "close" method on the client to safely clean up any remaining background resources.
    try (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create(datasetServiceSettings)) {
        String location = "us-central1";
        String importSchemaUri = "gs://google-cloud-aiplatform/schema/dataset/ioformat/" + "text_classification_single_label_io_format_1.0.0.yaml";
        GcsSource.Builder gcsSource = GcsSource.newBuilder();
        gcsSource.addUris(gcsSourceUri);
        DatasetName datasetName = DatasetName.of(project, location, datasetId);
        List<ImportDataConfig> importDataConfigList = Collections.singletonList(ImportDataConfig.newBuilder().setGcsSource(gcsSource).setImportSchemaUri(importSchemaUri).build());
        OperationFuture<ImportDataResponse, ImportDataOperationMetadata> importDataResponseFuture = datasetServiceClient.importDataAsync(datasetName, importDataConfigList);
        System.out.format("Operation name: %s\n", importDataResponseFuture.getInitialFuture().get().getName());
        System.out.println("Waiting for operation to finish...");
        ImportDataResponse importDataResponse = importDataResponseFuture.get(300, TimeUnit.SECONDS);
        System.out.format("Import Data Text Classification Response: %s\n", importDataResponse.toString());
    }
}
Also used : ImportDataResponse(com.google.cloud.aiplatform.v1.ImportDataResponse) GcsSource(com.google.cloud.aiplatform.v1.GcsSource) ImportDataConfig(com.google.cloud.aiplatform.v1.ImportDataConfig) DatasetServiceSettings(com.google.cloud.aiplatform.v1.DatasetServiceSettings) DatasetName(com.google.cloud.aiplatform.v1.DatasetName) DatasetServiceClient(com.google.cloud.aiplatform.v1.DatasetServiceClient) ImportDataOperationMetadata(com.google.cloud.aiplatform.v1.ImportDataOperationMetadata)

Example 3 with ImportDataConfig

use of com.google.cloud.aiplatform.v1.ImportDataConfig in project java-aiplatform by googleapis.

the class ImportDataTextSentimentAnalysisSample method importDataTextSentimentAnalysisSample.

static void importDataTextSentimentAnalysisSample(String project, String datasetId, String gcsSourceUri) throws IOException, InterruptedException, ExecutionException, TimeoutException {
    DatasetServiceSettings datasetServiceSettings = DatasetServiceSettings.newBuilder().setEndpoint("us-central1-aiplatform.googleapis.com:443").build();
    // the "close" method on the client to safely clean up any remaining background resources.
    try (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create(datasetServiceSettings)) {
        String location = "us-central1";
        String importSchemaUri = "gs://google-cloud-aiplatform/schema/dataset/ioformat/" + "text_sentiment_io_format_1.0.0.yaml";
        GcsSource.Builder gcsSource = GcsSource.newBuilder();
        gcsSource.addUris(gcsSourceUri);
        DatasetName datasetName = DatasetName.of(project, location, datasetId);
        List<ImportDataConfig> importDataConfigList = Collections.singletonList(ImportDataConfig.newBuilder().setGcsSource(gcsSource).setImportSchemaUri(importSchemaUri).build());
        OperationFuture<ImportDataResponse, ImportDataOperationMetadata> importDataResponseFuture = datasetServiceClient.importDataAsync(datasetName, importDataConfigList);
        System.out.format("Operation name: %s\n", importDataResponseFuture.getInitialFuture().get().getName());
        System.out.println("Waiting for operation to finish...");
        ImportDataResponse importDataResponse = importDataResponseFuture.get(300, TimeUnit.SECONDS);
        System.out.format("Import Data Text Sentiment Analysis Response: %s\n", importDataResponse.toString());
    }
}
Also used : ImportDataResponse(com.google.cloud.aiplatform.v1.ImportDataResponse) GcsSource(com.google.cloud.aiplatform.v1.GcsSource) ImportDataConfig(com.google.cloud.aiplatform.v1.ImportDataConfig) DatasetServiceSettings(com.google.cloud.aiplatform.v1.DatasetServiceSettings) DatasetName(com.google.cloud.aiplatform.v1.DatasetName) DatasetServiceClient(com.google.cloud.aiplatform.v1.DatasetServiceClient) ImportDataOperationMetadata(com.google.cloud.aiplatform.v1.ImportDataOperationMetadata)

Example 4 with ImportDataConfig

use of com.google.cloud.aiplatform.v1.ImportDataConfig in project java-aiplatform by googleapis.

the class ImportDataVideoClassificationSample method importDataVideoClassification.

static void importDataVideoClassification(String gcsSourceUri, String project, String datasetId) throws IOException, ExecutionException, InterruptedException, TimeoutException {
    DatasetServiceSettings datasetServiceSettings = DatasetServiceSettings.newBuilder().setEndpoint("us-central1-aiplatform.googleapis.com:443").build();
    // the "close" method on the client to safely clean up any remaining background resources.
    try (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create(datasetServiceSettings)) {
        String location = "us-central1";
        String importSchemaUri = "gs://google-cloud-aiplatform/schema/dataset/ioformat/" + "video_classification_io_format_1.0.0.yaml";
        GcsSource.Builder gcsSource = GcsSource.newBuilder();
        gcsSource.addUris(gcsSourceUri);
        DatasetName datasetName = DatasetName.of(project, location, datasetId);
        List<ImportDataConfig> importDataConfigs = Collections.singletonList(ImportDataConfig.newBuilder().setGcsSource(gcsSource).setImportSchemaUri(importSchemaUri).build());
        OperationFuture<ImportDataResponse, ImportDataOperationMetadata> importDataResponseFuture = datasetServiceClient.importDataAsync(datasetName, importDataConfigs);
        System.out.format("Operation name: %s\n", importDataResponseFuture.getInitialFuture().get().getName());
        System.out.println("Waiting for operation to finish...");
        ImportDataResponse importDataResponse = importDataResponseFuture.get(1800, TimeUnit.SECONDS);
        System.out.format("Import Data Video Classification Response: %s\n", importDataResponse.toString());
    }
}
Also used : ImportDataResponse(com.google.cloud.aiplatform.v1.ImportDataResponse) GcsSource(com.google.cloud.aiplatform.v1.GcsSource) ImportDataConfig(com.google.cloud.aiplatform.v1.ImportDataConfig) DatasetServiceSettings(com.google.cloud.aiplatform.v1.DatasetServiceSettings) DatasetName(com.google.cloud.aiplatform.v1.DatasetName) DatasetServiceClient(com.google.cloud.aiplatform.v1.DatasetServiceClient) ImportDataOperationMetadata(com.google.cloud.aiplatform.v1.ImportDataOperationMetadata)

Example 5 with ImportDataConfig

use of com.google.cloud.aiplatform.v1.ImportDataConfig in project java-aiplatform by googleapis.

the class ImportDataTextEntityExtractionSample method importDataTextEntityExtractionSample.

static void importDataTextEntityExtractionSample(String project, String datasetId, String gcsSourceUri) throws IOException, InterruptedException, ExecutionException, TimeoutException {
    DatasetServiceSettings datasetServiceSettings = DatasetServiceSettings.newBuilder().setEndpoint("us-central1-aiplatform.googleapis.com:443").build();
    // the "close" method on the client to safely clean up any remaining background resources.
    try (DatasetServiceClient datasetServiceClient = DatasetServiceClient.create(datasetServiceSettings)) {
        String location = "us-central1";
        String importSchemaUri = "gs://google-cloud-aiplatform/schema/dataset/ioformat/" + "text_extraction_io_format_1.0.0.yaml";
        GcsSource.Builder gcsSource = GcsSource.newBuilder();
        gcsSource.addUris(gcsSourceUri);
        DatasetName datasetName = DatasetName.of(project, location, datasetId);
        List<ImportDataConfig> importDataConfigList = Collections.singletonList(ImportDataConfig.newBuilder().setGcsSource(gcsSource).setImportSchemaUri(importSchemaUri).build());
        OperationFuture<ImportDataResponse, ImportDataOperationMetadata> importDataResponseFuture = datasetServiceClient.importDataAsync(datasetName, importDataConfigList);
        System.out.format("Operation name: %s\n", importDataResponseFuture.getInitialFuture().get().getName());
        System.out.println("Waiting for operation to finish...");
        ImportDataResponse importDataResponse = importDataResponseFuture.get(300, TimeUnit.SECONDS);
        System.out.format("Import Data Text Entity Extraction Response: %s\n", importDataResponse.toString());
    }
}
Also used : ImportDataResponse(com.google.cloud.aiplatform.v1.ImportDataResponse) GcsSource(com.google.cloud.aiplatform.v1.GcsSource) ImportDataConfig(com.google.cloud.aiplatform.v1.ImportDataConfig) DatasetServiceSettings(com.google.cloud.aiplatform.v1.DatasetServiceSettings) DatasetName(com.google.cloud.aiplatform.v1.DatasetName) DatasetServiceClient(com.google.cloud.aiplatform.v1.DatasetServiceClient) ImportDataOperationMetadata(com.google.cloud.aiplatform.v1.ImportDataOperationMetadata)

Aggregations

DatasetName (com.google.cloud.aiplatform.v1.DatasetName)8 DatasetServiceClient (com.google.cloud.aiplatform.v1.DatasetServiceClient)8 DatasetServiceSettings (com.google.cloud.aiplatform.v1.DatasetServiceSettings)8 GcsSource (com.google.cloud.aiplatform.v1.GcsSource)8 ImportDataConfig (com.google.cloud.aiplatform.v1.ImportDataConfig)8 ImportDataOperationMetadata (com.google.cloud.aiplatform.v1.ImportDataOperationMetadata)8 ImportDataResponse (com.google.cloud.aiplatform.v1.ImportDataResponse)8 ArrayList (java.util.ArrayList)1