File tree 3 files changed +24
-6
lines changed
src/main/java/com/google/cloud/speech/grpc/demos
3 files changed +24
-6
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # Copyright 2016 Google Inc. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ SRC_DIR=$( cd " $( dirname " $0 " ) /.." ; pwd)
17
+ java -cp ${SRC_DIR} /target/grpc-sample-1.0-jar-with-dependencies.jar \
18
+ com.google.cloud.speech.grpc.demos.SyncRecognizeClient " $@ "
Original file line number Diff line number Diff line change 27
27
import java .nio .file .Paths ;
28
28
29
29
/*
30
- * RecognitionAudioFactory takes a URI as an input and creates a RecognitionAudio. The URI can point to a
31
- * local file or a file on Google Cloud Storage.
30
+ * RecognitionAudioFactory takes a URI as an input and creates a RecognitionAudio.
31
+ * The URI can point to a local file or a file on Google Cloud Storage.
32
32
*/
33
33
public class RecognitionAudioFactory {
34
34
Original file line number Diff line number Diff line change 29
29
import com .google .cloud .speech .v1beta1 .RecognitionAudio ;
30
30
import com .google .cloud .speech .v1beta1 .RecognitionConfig ;
31
31
import com .google .cloud .speech .v1beta1 .RecognitionConfig .AudioEncoding ;
32
+ import com .google .cloud .speech .v1beta1 .SpeechGrpc ;
32
33
import com .google .cloud .speech .v1beta1 .SyncRecognizeRequest ;
33
34
import com .google .cloud .speech .v1beta1 .SyncRecognizeResponse ;
34
- import com .google .cloud .speech .v1beta1 .SpeechGrpc ;
35
35
import com .google .protobuf .TextFormat ;
36
36
37
37
import io .grpc .ManagedChannel ;
@@ -114,9 +114,9 @@ public void recognize() {
114
114
}
115
115
logger .info ("Sending " + audio .getContent ().size () + " bytes from audio uri input: " + input );
116
116
RecognitionConfig config = RecognitionConfig .newBuilder ()
117
- .setEncoding (AudioEncoding .LINEAR16 )
118
- .setSampleRate (samplingRate )
119
- .build ();
117
+ .setEncoding (AudioEncoding .LINEAR16 )
118
+ .setSampleRate (samplingRate )
119
+ .build ();
120
120
SyncRecognizeRequest request = SyncRecognizeRequest .newBuilder ()
121
121
.setConfig (config )
122
122
.setAudio (audio )
You can’t perform that action at this time.
0 commit comments