Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

speechrest -> speech_rest, update README to include speech_streaming #245

Merged
merged 2 commits into from
Apr 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions speech/api/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

# Google Cloud Speech API Sample (REST API)
# Google Cloud Speech API Samples

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

## Prerequisites

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

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

If you do not do this, you will see an error that looks something like this when
you run the example script:
`...<HttpError 403 when requesting https://speech.googleapis.com/v1/speech:recognize?alt=json returned "Request had insufficient authentication scopes.">`.
If you do not do this, the REST api will return a 403. The streaming sample will
just sort of hang silently.

See the
[Cloud Platform Auth Guide](https://cloud.google.com/docs/authentication#developer_workflow)
for more information.

### Install the dependencies

* If you're running the `speechrest.py` sample:
* If you're running the `speech_rest.py` sample:

```sh
$ pip install requirements-speechrest.txt
$ pip install requirements-speech_rest.txt
```

* If you're running the `speech_streaming.py` sample:
Expand All @@ -53,10 +54,10 @@ for more information.

## Run the example

* To run the `speechrest.py` sample:
* To run the `speech_rest.py` sample:

```sh
$ python speechrest.py resources/audio.raw
$ python speech_rest.py resources/audio.raw
```

You should see a response with the transcription result.
Expand All @@ -70,3 +71,7 @@ for more information.
The sample will run in a continuous loop, printing the data and metadata
it receives from the Speech API, which includes alternative transcriptions
of what it hears, and a confidence score. Say "exit" to exit the loop.

Note that the `speech_streaming.py` sample does not yet support python 3, as
the upstream `grpcio` library's support is [not yet
complete](https://github.com/grpc/grpc/issues/282).
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import re

from speechrest import main
from speech_rest import main


def test_main(resource, capsys):
Expand Down
1 change: 1 addition & 0 deletions speech/api/speech_streaming_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def mock_audio_stream(channels, rate, chunk):
return mock_audio_stream


# grpc doesn't yet support python3 https://github.com/grpc/grpc/issues/282
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you file a bug that mentions this on this project?

@pytest.mark.skipif(
sys.version_info >= (3, 0), reason="can't get grpc lib to work in python3")
def test_main(resource, monkeypatch, capsys):
Expand Down