Skip to content

Commit

Permalink
chore: update common templates, regenerate tests (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and chingor13 committed Nov 19, 2019
1 parent c6d960f commit 0dc1c97
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,19 @@ 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
*
* @param filePath Path to local pdf file, e.g. /path/document.pdf
*/
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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,19 @@ 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
*
* @param storageUri Cloud Storage URI to source image in the format gs://[bucket]/[file]
*/
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;
Expand Down

0 comments on commit 0dc1c97

Please sign in to comment.