From 0dc1c97a7a24c321a7f713be2f67108e70e855d8 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 19 Nov 2019 12:37:30 -0800 Subject: [PATCH] chore: update common templates, regenerate tests (#20) --- .../vision/v1/VisionAsyncBatchAnnotateImages.java | 9 +++++++-- .../examples/vision/v1/VisionBatchAnnotateFiles.java | 7 ++++++- .../examples/vision/v1/VisionBatchAnnotateFilesGcs.java | 7 ++++++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/vision/src/main/java/com/google/cloud/examples/vision/v1/VisionAsyncBatchAnnotateImages.java b/vision/src/main/java/com/google/cloud/examples/vision/v1/VisionAsyncBatchAnnotateImages.java index f7ebf8ff6c0..9d231d1ac4c 100644 --- a/vision/src/main/java/com/google/cloud/examples/vision/v1/VisionAsyncBatchAnnotateImages.java +++ b/vision/src/main/java/com/google/cloud/examples/vision/v1/VisionAsyncBatchAnnotateImages.java @@ -63,11 +63,16 @@ public class VisionAsyncBatchAnnotateImages { * import java.util.List; */ + public static void sampleAsyncBatchAnnotateImages() { + // TODO(developer): Replace these variables before running the sample. + String inputImageUri = "gs://cloud-samples-data/vision/label/wakeupcat.jpg"; + String outputUri = "gs://your-bucket/prefix/"; + sampleAsyncBatchAnnotateImages(inputImageUri, outputUri); + } + /** Perform async batch image annotation */ public static void sampleAsyncBatchAnnotateImages(String inputImageUri, String outputUri) { try (ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create()) { - // inputImageUri = "gs://cloud-samples-data/vision/label/wakeupcat.jpg"; - // outputUri = "gs://your-bucket/prefix/"; ImageSource source = ImageSource.newBuilder().setImageUri(inputImageUri).build(); Image image = Image.newBuilder().setSource(source).build(); Feature.Type type = Feature.Type.LABEL_DETECTION; diff --git a/vision/src/main/java/com/google/cloud/examples/vision/v1/VisionBatchAnnotateFiles.java b/vision/src/main/java/com/google/cloud/examples/vision/v1/VisionBatchAnnotateFiles.java index d3fdc3df774..b1b6c5b2a33 100644 --- a/vision/src/main/java/com/google/cloud/examples/vision/v1/VisionBatchAnnotateFiles.java +++ b/vision/src/main/java/com/google/cloud/examples/vision/v1/VisionBatchAnnotateFiles.java @@ -70,6 +70,12 @@ public class VisionBatchAnnotateFiles { * import java.util.List; */ + public static void sampleBatchAnnotateFiles() { + // TODO(developer): Replace these variables before running the sample. + String filePath = "resources/kafka.pdf"; + sampleBatchAnnotateFiles(filePath); + } + /** * Perform batch file annotation * @@ -77,7 +83,6 @@ public class VisionBatchAnnotateFiles { */ public static void sampleBatchAnnotateFiles(String filePath) { try (ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create()) { - // filePath = "resources/kafka.pdf"; // Supported mime_type: application/pdf, image/tiff, image/gif String mimeType = "application/pdf"; diff --git a/vision/src/main/java/com/google/cloud/examples/vision/v1/VisionBatchAnnotateFilesGcs.java b/vision/src/main/java/com/google/cloud/examples/vision/v1/VisionBatchAnnotateFilesGcs.java index 2625c079309..a6b45d085e2 100644 --- a/vision/src/main/java/com/google/cloud/examples/vision/v1/VisionBatchAnnotateFilesGcs.java +++ b/vision/src/main/java/com/google/cloud/examples/vision/v1/VisionBatchAnnotateFilesGcs.java @@ -64,6 +64,12 @@ public class VisionBatchAnnotateFilesGcs { * import java.util.List; */ + public static void sampleBatchAnnotateFiles() { + // TODO(developer): Replace these variables before running the sample. + String storageUri = "gs://cloud-samples-data/vision/document_understanding/kafka.pdf"; + sampleBatchAnnotateFiles(storageUri); + } + /** * Perform batch file annotation * @@ -71,7 +77,6 @@ public class VisionBatchAnnotateFilesGcs { */ public static void sampleBatchAnnotateFiles(String storageUri) { try (ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.create()) { - // storageUri = "gs://cloud-samples-data/vision/document_understanding/kafka.pdf"; GcsSource gcsSource = GcsSource.newBuilder().setUri(storageUri).build(); InputConfig inputConfig = InputConfig.newBuilder().setGcsSource(gcsSource).build(); Feature.Type type = Feature.Type.DOCUMENT_TEXT_DETECTION;