Skip to content
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
11 changes: 11 additions & 0 deletions speech/grpc/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ To run this sample:
[--sample_rate SAMPLE_RATE]
input_uri

Transcribes a FLAC audio file stored in Google Cloud Storage using GRPC.

Example usage:
python transcribe.py --encoding=FLAC --sample_rate=16000 gs://speech-demo/audio.flac

positional arguments:
input_uri

Expand Down Expand Up @@ -148,6 +153,12 @@ To run this sample:
[--sample_rate SAMPLE_RATE]
input_uri

Sample that transcribes a FLAC audio file stored in Google Cloud Storage,
using async GRPC.

Example usage:
python transcribe_async.py --encoding=FLAC --sample_rate=16000 gs://speech-demo/audio.flac

positional arguments:
input_uri

Expand Down
12 changes: 9 additions & 3 deletions speech/grpc/transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Sample that transcribes a FLAC audio file stored in Google Cloud Storage,
using GRPC."""
"""Transcribes a FLAC audio file stored in Google Cloud Storage using GRPC.

Example usage:
python transcribe.py --encoding=FLAC --sample_rate=16000 \
gs://speech-demo/audio.flac
"""

import argparse

Expand Down Expand Up @@ -80,7 +84,9 @@ def _gcs_uri(text):
PROTO_URL = ('https://github.com/googleapis/googleapis/blob/master/'
'google/cloud/speech/v1beta1/cloud_speech.proto')
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser = argparse.ArgumentParser(
description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('input_uri', type=_gcs_uri)
parser.add_argument(
'--encoding', default='LINEAR16', choices=[
Expand Down
14 changes: 11 additions & 3 deletions speech/grpc/transcribe_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Sample that transcribes a FLAC audio file stored in Google Cloud Storage,
using async GRPC."""
"""
Sample that transcribes a FLAC audio file stored in Google Cloud Storage,
using async GRPC.

Example usage:
python transcribe_async.py --encoding=FLAC --sample_rate=16000 \
gs://speech-demo/audio.flac
"""

import argparse
import time
Expand Down Expand Up @@ -105,7 +111,9 @@ def _gcs_uri(text):


if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser = argparse.ArgumentParser(
description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('input_uri', type=_gcs_uri)
parser.add_argument(
'--encoding', default='LINEAR16', choices=[
Expand Down