Skip to content

Commit 92d24a7

Browse files
committed
Merge pull request #245 from GoogleCloudPlatform/speech-streaming
speechrest -> speech_rest, update README to include speech_streaming
2 parents b187310 + 079d5f1 commit 92d24a7

File tree

5 files changed

+17
-11
lines changed

5 files changed

+17
-11
lines changed

speech/api/README.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11

2-
# Google Cloud Speech API Sample (REST API)
2+
# Google Cloud Speech API Samples
33

4-
This example demos accessing the [Google Cloud Speech API](http://cloud.google.com/speech)
5-
via its REST API.
4+
These examples demo accessing the [Google Cloud Speech API](http://cloud.google.com/speech)
5+
in streaming mode (via its gRPC API) and in non-streaming mode (via its REST
6+
API).
67

78
## Prerequisites
89

@@ -30,19 +31,19 @@ downloaded service account credentials before running this example:
3031

3132
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/credentials-key.json
3233

33-
If you do not do this, you will see an error that looks something like this when
34-
you run the example script:
35-
`...<HttpError 403 when requesting https://speech.googleapis.com/v1/speech:recognize?alt=json returned "Request had insufficient authentication scopes.">`.
34+
If you do not do this, the REST api will return a 403. The streaming sample will
35+
just sort of hang silently.
36+
3637
See the
3738
[Cloud Platform Auth Guide](https://cloud.google.com/docs/authentication#developer_workflow)
3839
for more information.
3940

4041
### Install the dependencies
4142

42-
* If you're running the `speechrest.py` sample:
43+
* If you're running the `speech_rest.py` sample:
4344

4445
```sh
45-
$ pip install requirements-speechrest.txt
46+
$ pip install requirements-speech_rest.txt
4647
```
4748

4849
* If you're running the `speech_streaming.py` sample:
@@ -53,10 +54,10 @@ for more information.
5354
5455
## Run the example
5556
56-
* To run the `speechrest.py` sample:
57+
* To run the `speech_rest.py` sample:
5758
5859
```sh
59-
$ python speechrest.py resources/audio.raw
60+
$ python speech_rest.py resources/audio.raw
6061
```
6162
6263
You should see a response with the transcription result.
@@ -70,3 +71,7 @@ for more information.
7071
The sample will run in a continuous loop, printing the data and metadata
7172
it receives from the Speech API, which includes alternative transcriptions
7273
of what it hears, and a confidence score. Say "exit" to exit the loop.
74+
75+
Note that the `speech_streaming.py` sample does not yet support python 3, as
76+
the upstream `grpcio` library's support is [not yet
77+
complete](https://github.com/grpc/grpc/issues/282).
File renamed without changes.

speech/api/speechrest_test.py renamed to speech/api/speech_rest_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import re
1515

16-
from speechrest import main
16+
from speech_rest import main
1717

1818

1919
def test_main(resource, capsys):

speech/api/speech_streaming_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def mock_audio_stream(channels, rate, chunk):
5353
return mock_audio_stream
5454

5555

56+
# grpc doesn't yet support python3 https://github.com/grpc/grpc/issues/282
5657
@pytest.mark.skipif(
5758
sys.version_info >= (3, 0), reason="can't get grpc lib to work in python3")
5859
def test_main(resource, monkeypatch, capsys):

0 commit comments

Comments
 (0)