File tree Expand file tree Collapse file tree 13 files changed +52
-22
lines changed
appengine/flexible/django_cloudsql Expand file tree Collapse file tree 13 files changed +52
-22
lines changed Original file line number Diff line number Diff line change @@ -9,4 +9,3 @@ beta_settings:
9
9
runtime_config :
10
10
python_version : 3
11
11
# [END runtime]
12
-
Original file line number Diff line number Diff line change 81
81
# [START dbconfig]
82
82
DATABASES = {
83
83
'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' ,
85
87
'NAME' : 'polls' ,
86
88
'USER' : '<your-database-user>' ,
87
89
'PASSWORD' : '<your-database-password>' ,
Original file line number Diff line number Diff line change @@ -2,3 +2,4 @@ Django==1.11
2
2
mysqlclient == 1.3.10
3
3
wheel == 0.29.0
4
4
gunicorn == 19.7.1
5
+ psycopg2 == 2.7.1
Original file line number Diff line number Diff line change 1
- google-cloud-language == 0.24.0
1
+ google-cloud-language == 0.24.1
Original file line number Diff line number Diff line change 1
- google-cloud-language == 0.24.0
1
+ google-cloud-language == 0.24.1
Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ To run this sample:
127
127
128
128
Example usage:
129
129
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
131
131
132
132
positional arguments:
133
133
path File or GCS path for audio file to be recognized
@@ -136,6 +136,31 @@ To run this sample:
136
136
-h, --help show this help message and exit
137
137
138
138
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
+
139
164
140
165
141
166
The client library
Original file line number Diff line number Diff line change @@ -22,5 +22,8 @@ samples:
22
22
- name: Transcribe async
23
23
file: transcribe_async.py
24
24
show_help: true
25
+ - name: Transcribe Streaming
26
+ file: transcribe_streaming.py
27
+ show_help: true
25
28
26
29
cloud_client_library: true
Original file line number Diff line number Diff line change @@ -35,14 +35,14 @@ def run_quickstart():
35
35
# Loads the audio into memory
36
36
with io .open (file_name , 'rb' ) as audio_file :
37
37
content = audio_file .read ()
38
- audio_sample = speech_client .sample (
38
+ sample = speech_client .sample (
39
39
content,
40
40
source_uri = None ,
41
41
encoding = 'LINEAR16' ,
42
- sample_rate = 16000 )
42
+ sample_rate_hertz = 16000 )
43
43
44
44
# Detects speech in the audio file
45
- alternatives = speech_client . speech_api . sync_recognize ( audio_sample )
45
+ alternatives = sample . recognize ( 'en-US' )
46
46
47
47
for alternative in alternatives :
48
48
print ('Transcript: {}' .format (alternative .transcript ))
Original file line number Diff line number Diff line change 1
- google-cloud-speech == 0.23 .0
1
+ google-cloud-speech == 0.25 .0
Original file line number Diff line number Diff line change @@ -39,9 +39,9 @@ def transcribe_file(speech_file):
39
39
content = content ,
40
40
source_uri = None ,
41
41
encoding = 'LINEAR16' ,
42
- sample_rate = 16000 )
42
+ sample_rate_hertz = 16000 )
43
43
44
- alternatives = speech_client . speech_api . sync_recognize ( audio_sample )
44
+ alternatives = audio_sample . recognize ( 'en-US' )
45
45
for alternative in alternatives :
46
46
print ('Transcript: {}' .format (alternative .transcript ))
47
47
@@ -55,9 +55,9 @@ def transcribe_gcs(gcs_uri):
55
55
content = None ,
56
56
source_uri = gcs_uri ,
57
57
encoding = 'FLAC' ,
58
- sample_rate = 16000 )
58
+ sample_rate_hertz = 16000 )
59
59
60
- alternatives = speech_client . speech_api . sync_recognize ( audio_sample )
60
+ alternatives = audio_sample . recognize ( 'en-US' )
61
61
for alternative in alternatives :
62
62
print ('Transcript: {}' .format (alternative .transcript ))
63
63
You can’t perform that action at this time.
0 commit comments