-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Speech transcribe async bug #688
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
Changes from 3 commits
8a7355e
0a3878e
e4c1f71
695cd78
d3fee87
111eb09
6f6134b
fb9d2b6
bcbe0ab
2322792
01a1603
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # Copyright 2016, Google, Inc. | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # 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. | ||
|
|
||
| import os | ||
| import re | ||
|
|
||
| from google.cloud import storage | ||
|
|
||
| from transcribe_async import main | ||
|
|
||
|
|
||
| def test_main(resource, capsys): | ||
|
|
||
| # Upload an audio file to the default testing CLOUD_STORAGE_BUCKET | ||
| storage_client = storage.Client() | ||
| bucket = storage_client.get_bucket(os.environ.get('CLOUD_STORAGE_BUCKET')) | ||
| blob = bucket.blob('audio.raw') | ||
| blob.upload_from_filename('speech/grpc/resources/audio.raw') | ||
|
|
||
| # Run the transcribe_async sample on the audio file, verify correct results | ||
| speech_storage_uri = 'gs://' + os.environ.get('CLOUD_STORAGE_BUCKET') | ||
|
||
| speech_storage_uri += '/audio.raw' | ||
| main(speech_storage_uri, 'LINEAR16', 16000) | ||
| out, err = capsys.readouterr() | ||
| assert re.search(r'how old is the Brooklyn Bridge', out, re.DOTALL | re.I) | ||
|
|
||
| # Delete audio file from storage bucket | ||
| blob.delete() | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # Copyright 2016, Google, Inc. | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # 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. | ||
|
|
||
| import os | ||
| import re | ||
|
|
||
| from google.cloud import storage | ||
|
|
||
| from transcribe_async import main | ||
|
|
||
|
|
||
| def test_main(resource, capsys): | ||
|
|
||
| # Upload an audio file to the default testing CLOUD_STORAGE_BUCKET | ||
| storage_client = storage.Client() | ||
| bucket = storage_client.get_bucket(os.environ.get('CLOUD_STORAGE_BUCKET')) | ||
| blob = bucket.blob('audio.raw') | ||
| blob.upload_from_filename('speech/grpc/resources/audio.raw') | ||
|
|
||
| # Run the transcribe sample on the audio file, verify correct results | ||
| speech_storage_uri = 'gs://' + os.environ.get('CLOUD_STORAGE_BUCKET') | ||
| speech_storage_uri += '/audio.raw' | ||
| main(speech_storage_uri, 'LINEAR16', 16000) | ||
| out, err = capsys.readouterr() | ||
| assert re.search(r'how old is the Brooklyn Bridge', out, re.DOTALL | re.I) | ||
|
|
||
| # Delete audio file from storage bucket | ||
| blob.delete() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What? Jon didn't wasn't like, "Please use single quotes for strings"?? WHO ARE YOU AND WHAT HAVE YOU DONE TO @jonparrott ?!? :)
I'd just combine this into one string, for brevity:
We should be paid proportional to like, the inverse of lines of code :) Except then we'd be incentivized to not write any code at all... hm...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I blame my lack of sleep.