From db76b3d5461b5f3416233035a94d34dda58f397e Mon Sep 17 00:00:00 2001 From: Gus Class Date: Wed, 12 Apr 2017 09:33:45 -0700 Subject: [PATCH 1/4] Adds async examples --- speech/cloud-client/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/speech/cloud-client/README.md b/speech/cloud-client/README.md index c0397107edb..98a13274ba6 100644 --- a/speech/cloud-client/README.md +++ b/speech/cloud-client/README.md @@ -31,8 +31,20 @@ You can then run a given `ClassName` via: -Dexec.args="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" +``` + ### 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'" ``` + +### 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/brooklyn.flac'" +``` From 29749956db4719c03c850e8e37a815da89f700f0 Mon Sep 17 00:00:00 2001 From: Gus Class Date: Wed, 12 Apr 2017 11:10:22 -0700 Subject: [PATCH 2/4] Adds link to Cloud Client. --- speech/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/speech/README.md b/speech/README.md index e6e4b640430..0744f0f4498 100644 --- a/speech/README.md +++ b/speech/README.md @@ -6,3 +6,7 @@ with Java. - [grpc](grpc) A sample for accessing Cloud Speech streaming and non streaming apis with [gRPC](http://www.grpc.io/). + +- [Cloud Client](cloud-client) + + A sample for accessing Cloud Speech streaming and non streaming apis using the [Cloud Client Library for Java](https://github.com/GoogleCloudPlatform/google-cloud-java). From 9382df60c4581ae1104388c4f18798bbd710f85a Mon Sep 17 00:00:00 2001 From: Gus Class Date: Wed, 12 Apr 2017 15:03:58 -0700 Subject: [PATCH 3/4] Changes sleep duration --- .../src/main/java/com/example/speech/Recognize.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 55f7a63f2ef..554292273a3 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 @@ -172,7 +172,7 @@ public static void asyncRecognizeFile(String fileName) throws Exception, IOExcep speech.longRunningRecognizeAsync(config, audio); while (!response.isDone()) { System.out.println("Waiting for response..."); - Thread.sleep(200); + Thread.sleep(10000); } List results = response.get().getResultsList(); From fe03439f59606d36297d9dc2fd0b782c70fba04c Mon Sep 17 00:00:00 2001 From: Gus Class Date: Wed, 12 Apr 2017 15:21:55 -0700 Subject: [PATCH 4/4] Adds GCS example. --- .../src/main/java/com/example/speech/Recognize.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 554292273a3..71659e7d396 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 @@ -211,7 +211,7 @@ public static void asyncRecognizeGcs(String gcsUri) throws Exception, IOExceptio speech.longRunningRecognizeAsync(config, audio); while (!response.isDone()) { System.out.println("Waiting for response..."); - Thread.sleep(200); + Thread.sleep(10000); } List results = response.get().getResultsList();