Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e48b8b0

Browse filesBrowse files
author
Jon Wayne Parrott
committed
Merge branch 'master' of github.com:GoogleCloudPlatform/python-docs-samples
2 parents 9c3c073 + 166e787 commit e48b8b0
Copy full SHA for e48b8b0

File tree

Expand file treeCollapse file tree

13 files changed

+52
-22
lines changed
Filter options
Expand file treeCollapse file tree

13 files changed

+52
-22
lines changed

‎appengine/flexible/django_cloudsql/app.yaml

Copy file name to clipboardExpand all lines: appengine/flexible/django_cloudsql/app.yaml
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ beta_settings:
99
runtime_config:
1010
python_version: 3
1111
# [END runtime]
12-

‎appengine/flexible/django_cloudsql/mysite/settings.py

Copy file name to clipboardExpand all lines: appengine/flexible/django_cloudsql/mysite/settings.py
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@
8181
# [START dbconfig]
8282
DATABASES = {
8383
'default': {
84-
'ENGINE': 'django.db.backends.mysql',
84+
# If you are using Cloud SQL for MySQL rather than PostgreSQL, set
85+
# 'ENGINE': 'django.db.backends.mysql' instead of the following.
86+
'ENGINE': 'django.db.backends.postgresql',
8587
'NAME': 'polls',
8688
'USER': '<your-database-user>',
8789
'PASSWORD': '<your-database-password>',

‎appengine/flexible/django_cloudsql/requirements.txt

Copy file name to clipboardExpand all lines: appengine/flexible/django_cloudsql/requirements.txt
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ Django==1.11
22
mysqlclient==1.3.10
33
wheel==0.29.0
44
gunicorn==19.7.1
5+
psycopg2==2.7.1
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
google-cloud-language==0.24.0
1+
google-cloud-language==0.24.1

‎language/sentiment/requirements.txt

Copy file name to clipboard
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
google-cloud-language==0.24.0
1+
google-cloud-language==0.24.1

‎speech/cloud-client/README.rst

Copy file name to clipboardExpand all lines: speech/cloud-client/README.rst
+26-1Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ To run this sample:
127127
128128
Example usage:
129129
python transcribe_async.py resources/audio.raw
130-
python transcribe_async.py gs://cloud-samples-tests/speech/brooklyn.flac
130+
python transcribe_async.py gs://cloud-samples-tests/speech/brooklyn.raw
131131
132132
positional arguments:
133133
path File or GCS path for audio file to be recognized
@@ -136,6 +136,31 @@ To run this sample:
136136
-h, --help show this help message and exit
137137
138138
139+
Transcribe Streaming
140+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
141+
142+
143+
144+
To run this sample:
145+
146+
.. code-block:: bash
147+
148+
$ python transcribe_streaming.py
149+
150+
usage: transcribe_streaming.py [-h] stream
151+
152+
Google Cloud Speech API sample application using the streaming API.
153+
154+
Example usage:
155+
python transcribe_streaming.py resources/audio.raw
156+
157+
positional arguments:
158+
stream File to stream to the API
159+
160+
optional arguments:
161+
-h, --help show this help message and exit
162+
163+
139164
140165
141166
The client library

‎speech/cloud-client/README.rst.in

Copy file name to clipboardExpand all lines: speech/cloud-client/README.rst.in
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,8 @@ samples:
2222
- name: Transcribe async
2323
file: transcribe_async.py
2424
show_help: true
25+
- name: Transcribe Streaming
26+
file: transcribe_streaming.py
27+
show_help: true
2528

2629
cloud_client_library: true

‎speech/cloud-client/quickstart.py

Copy file name to clipboardExpand all lines: speech/cloud-client/quickstart.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ def run_quickstart():
3535
# Loads the audio into memory
3636
with io.open(file_name, 'rb') as audio_file:
3737
content = audio_file.read()
38-
audio_sample = speech_client.sample(
38+
sample = speech_client.sample(
3939
content,
4040
source_uri=None,
4141
encoding='LINEAR16',
42-
sample_rate=16000)
42+
sample_rate_hertz=16000)
4343

4444
# Detects speech in the audio file
45-
alternatives = speech_client.speech_api.sync_recognize(audio_sample)
45+
alternatives = sample.recognize('en-US')
4646

4747
for alternative in alternatives:
4848
print('Transcript: {}'.format(alternative.transcript))

‎speech/cloud-client/requirements.txt

Copy file name to clipboard
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
google-cloud-speech==0.23.0
1+
google-cloud-speech==0.25.0

‎speech/cloud-client/transcribe.py

Copy file name to clipboardExpand all lines: speech/cloud-client/transcribe.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ def transcribe_file(speech_file):
3939
content=content,
4040
source_uri=None,
4141
encoding='LINEAR16',
42-
sample_rate=16000)
42+
sample_rate_hertz=16000)
4343

44-
alternatives = speech_client.speech_api.sync_recognize(audio_sample)
44+
alternatives = audio_sample.recognize('en-US')
4545
for alternative in alternatives:
4646
print('Transcript: {}'.format(alternative.transcript))
4747

@@ -55,9 +55,9 @@ def transcribe_gcs(gcs_uri):
5555
content=None,
5656
source_uri=gcs_uri,
5757
encoding='FLAC',
58-
sample_rate=16000)
58+
sample_rate_hertz=16000)
5959

60-
alternatives = speech_client.speech_api.sync_recognize(audio_sample)
60+
alternatives = audio_sample.recognize('en-US')
6161
for alternative in alternatives:
6262
print('Transcript: {}'.format(alternative.transcript))
6363

‎speech/cloud-client/transcribe_async.py

Copy file name to clipboardExpand all lines: speech/cloud-client/transcribe_async.py
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
2020
Example usage:
2121
python transcribe_async.py resources/audio.raw
22-
python transcribe_async.py gs://cloud-samples-tests/speech/brooklyn.flac
22+
python transcribe_async.py gs://cloud-samples-tests/speech/brooklyn.raw
2323
"""
2424

2525
import argparse
@@ -38,9 +38,9 @@ def transcribe_file(speech_file):
3838
content,
3939
source_uri=None,
4040
encoding='LINEAR16',
41-
sample_rate=16000)
41+
sample_rate_hertz=16000)
4242

43-
operation = speech_client.speech_api.async_recognize(audio_sample)
43+
operation = audio_sample.long_running_recognize('en-US')
4444

4545
retry_count = 100
4646
while retry_count > 0 and not operation.complete:
@@ -67,10 +67,10 @@ def transcribe_gcs(gcs_uri):
6767
audio_sample = speech_client.sample(
6868
content=None,
6969
source_uri=gcs_uri,
70-
encoding='FLAC',
71-
sample_rate=16000)
70+
encoding='LINEAR16',
71+
sample_rate_hertz=16000)
7272

73-
operation = speech_client.speech_api.async_recognize(audio_sample)
73+
operation = audio_sample.long_running_recognize('en-US')
7474

7575
retry_count = 100
7676
while retry_count > 0 and not operation.complete:

‎speech/cloud-client/transcribe_async_test.py

Copy file name to clipboardExpand all lines: speech/cloud-client/transcribe_async_test.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_transcribe(capsys):
2929

3030
def test_transcribe_gcs(capsys):
3131
transcribe_async.transcribe_gcs(
32-
'gs://python-docs-samples-tests/speech/audio.flac')
32+
'gs://python-docs-samples-tests/speech/audio.raw')
3333
out, err = capsys.readouterr()
3434

3535
assert re.search(r'how old is the Brooklyn Bridge', out, re.DOTALL | re.I)

‎speech/cloud-client/transcribe_streaming.py

Copy file name to clipboardExpand all lines: speech/cloud-client/transcribe_streaming.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ def transcribe_streaming(stream_file):
3535
audio_sample = speech_client.sample(
3636
stream=audio_file,
3737
encoding=speech.encoding.Encoding.LINEAR16,
38-
sample_rate=16000)
39-
alternatives = audio_sample.streaming_recognize()
38+
sample_rate_hertz=16000)
39+
alternatives = audio_sample.streaming_recognize('en-US')
4040

4141
for alternative in alternatives:
4242
print('Finished: {}'.format(alternative.is_final))

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.