From 923798182ae0971c80b77eeb23ee3128c2d44552 Mon Sep 17 00:00:00 2001 From: Gus Class Date: Mon, 1 May 2017 19:56:24 -0700 Subject: [PATCH 1/3] Fixes dependencies and class package changes. --- speech/cloud-client/README.md | 25 +++++++-------- speech/cloud-client/pom.xml | 32 +++++++++++++++++-- .../java/com/example/speech/Recognize.java | 2 +- 3 files changed, 42 insertions(+), 17 deletions(-) diff --git a/speech/cloud-client/README.md b/speech/cloud-client/README.md index c9d1bae43b5..83565a21e04 100644 --- a/speech/cloud-client/README.md +++ b/speech/cloud-client/README.md @@ -15,36 +15,33 @@ Install [Maven](http://maven.apache.org/). Build your project with: - mvn clean package -DskipTests - -You can then run a given `ClassName` via: - - mvn exec:java -Dexec.mainClass=com.example.speech.ClassName + mvn clean compile assembly:single ### Transcribe a local audio file (using the quickstart sample) - mvn exec:java -Dexec.mainClass=com.example.speech.QuickstartSample + java -cp target/speech-google-cloud-samples-1.0.0-jar-with-dependencies.jar \ + com.example.speech.QuickstartSample ### Transcribe a local audio file (using the recognize sample) ``` - mvn exec:java -Dexec.mainClass=com.example.speech.Recognize \ - -Dexec.args="syncrecognize ./resources/audio.raw" + java -cp target/speech-google-cloud-samples-1.0.0-jar-with-dependencies.jar \ + com.example.speech.Recognize syncrecognize ./resources/audio.raw ``` ### Asynchronously transcribe a local audio file (using the recognize sample) ``` - mvn exec:java -Dexec.mainClass=com.example.speech.Recognize \ - -Dexec.args="asyncrecognize ./resources/audio.raw" + java -cp target/speech-google-cloud-samples-1.0.0-jar-with-dependencies.jar \ + com.example.speech.Recognize asyncrecognize ./resources/audio.raw ``` ### Transcribe a remote audio file (using the recognize sample) ``` - mvn exec:java -Dexec.mainClass=com.example.speech.Recognize \ - -Dexec.args="syncrecognize 'gs://cloud-samples-tests/speech/brooklyn.flac'" + java -cp target/speech-google-cloud-samples-1.0.0-jar-with-dependencies.jar \ + com.example.speech.Recognize syncrecognize gs://cloud-samples-tests/speech/brooklyn.flac ``` ### Asynchronously transcribe a remote audio file (using the recognize sample) ``` - mvn exec:java -Dexec.mainClass=com.example.speech.Recognize \ - -Dexec.args="asyncrecognize 'gs://cloud-samples-tests/speech/vr.flac'" + java -cp target/speech-google-cloud-samples-1.0.0-jar-with-dependencies.jar \ + com.example.speech.Recognize asyncrecognize gs://cloud-samples-tests/speech/vr.flac ``` diff --git a/speech/cloud-client/pom.xml b/speech/cloud-client/pom.xml index 6ccbf48580a..f193a8bded0 100644 --- a/speech/cloud-client/pom.xml +++ b/speech/cloud-client/pom.xml @@ -37,8 +37,18 @@ com.google.cloud - google-cloud - 0.13.0-alpha + google-cloud-speech + 0.17.1-alpha + + + com.google.api + gax + 1.0.0 + + + com.google.api + gax-grpc + 0.16.0 @@ -56,4 +66,22 @@ test + + + + + maven-assembly-plugin + + + + com.example.language.QuickstartSample + + + + jar-with-dependencies + + + + + diff --git a/speech/cloud-client/src/main/java/com/example/speech/Recognize.java b/speech/cloud-client/src/main/java/com/example/speech/Recognize.java index 71659e7d396..9863d9bc1b4 100644 --- a/speech/cloud-client/src/main/java/com/example/speech/Recognize.java +++ b/speech/cloud-client/src/main/java/com/example/speech/Recognize.java @@ -16,7 +16,7 @@ package com.example.speech; -import com.google.api.gax.core.ApiStreamObserver; +import com.google.api.gax.grpc.ApiStreamObserver; import com.google.api.gax.grpc.OperationFuture; import com.google.api.gax.grpc.StreamingCallable; import com.google.cloud.speech.spi.v1.SpeechClient; From df8f8ce6fca4812e495c054e04613e86ff7e1caa Mon Sep 17 00:00:00 2001 From: Gus Class Date: Tue, 2 May 2017 09:14:38 -0700 Subject: [PATCH 2/3] Guava exclusions so Truth doesn't conflict with Cloud Client --- speech/cloud-client/pom.xml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/speech/cloud-client/pom.xml b/speech/cloud-client/pom.xml index f193a8bded0..efa45d18bd3 100644 --- a/speech/cloud-client/pom.xml +++ b/speech/cloud-client/pom.xml @@ -28,8 +28,8 @@ - 1.8 - 1.8 + 1.7 + 1.7 UTF-8 @@ -44,11 +44,23 @@ com.google.api gax 1.0.0 + + + com.google.guava + * + + com.google.api gax-grpc 0.16.0 + + + com.google.guava + * + + From 188e6edd98921dd6de733791b367d42ff1663f59 Mon Sep 17 00:00:00 2001 From: Gus Class Date: Tue, 2 May 2017 09:20:58 -0700 Subject: [PATCH 3/3] Upgrades vision to 0.17.1 --- vision/cloud-client/pom.xml | 2 +- .../cloud-client/src/main/java/com/example/vision/Detect.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vision/cloud-client/pom.xml b/vision/cloud-client/pom.xml index 3f744ea2f34..23183fc5f24 100644 --- a/vision/cloud-client/pom.xml +++ b/vision/cloud-client/pom.xml @@ -38,7 +38,7 @@ com.google.cloud google-cloud-vision - 0.13.0-beta + 0.17.1-beta diff --git a/vision/cloud-client/src/main/java/com/example/vision/Detect.java b/vision/cloud-client/src/main/java/com/example/vision/Detect.java index bf06b7a276d..c07bc70e7f6 100644 --- a/vision/cloud-client/src/main/java/com/example/vision/Detect.java +++ b/vision/cloud-client/src/main/java/com/example/vision/Detect.java @@ -41,7 +41,7 @@ import com.google.cloud.vision.v1.WebDetection.WebPage; import com.google.cloud.vision.v1.Word; import com.google.protobuf.ByteString; -import org.joda.time.Duration; +import org.threeten.bp.Duration; import java.io.FileInputStream; import java.io.IOException; @@ -210,7 +210,7 @@ public static void detectFacesGcs(String gcsPath, PrintStream out) throws IOExce imageAnnotatorSettingsBuilder .batchAnnotateImagesSettings() .getRetrySettingsBuilder() - .setTotalTimeout(Duration.standardSeconds(30)); + .setTotalTimeout(Duration.ofSeconds(30)); ImageAnnotatorSettings settings = imageAnnotatorSettingsBuilder.build(); ImageSource imgSource = ImageSource.newBuilder().setGcsImageUri(gcsPath).build();