Uh oh!
There was an error while loading. Please reload this page.
adding example for streaming audio - #826
Conversation
theacodes
commented
Feb 27, 2017
@gguuss can you take a look? |
daspecster
left a comment
There was a problem hiding this comment.
@yogeshg, @jonparrott and @gguuss are the maintainers/gatekeepers here(probably others as well?). They will have a few other suggestions as well.
| @@ -0,0 +1,51 @@ | |||
| #!/usr/bin/env python | |||
| # author: Yogesh Garg | |||
There was a problem hiding this comment.
@yogeshg I think to be accepted you would need to add the Google copyright comment as can be seen here.
Your authorship should be in the commits. I don't see it displayed this way in the other files but @gguuss or @jonparrott would know for sure.
| """ | ||
| import logging |
There was a problem hiding this comment.
I'm not 100% sure what this does but I imagine you would want to follow the style here with the # [START import_libraries].
| def transcribe_stream(stream): | ||
| logging.debug('{} is closed: {}'.format(str(stream), stream.closed)) | ||
| sample = speech_client.sample( stream=stream, |
There was a problem hiding this comment.
Extra space before stream=stream here.
- sample( stream=stream)+ sample(stream=stream)| encoding=speech.Encoding.LINEAR16, | ||
| sample_rate=SAMPLE_RATE) | ||
| results = list(sample.streaming_recognize()) | ||
| print 'results len:{}' |
There was a problem hiding this comment.
I think this needs to have parentheses for Python 3 support.
- print 'results len:{}'+ print('results len: {})| sample_rate=SAMPLE_RATE) | ||
| results = list(sample.streaming_recognize()) | ||
| print 'results len:{}' | ||
| for r in results: |
There was a problem hiding this comment.
Generally one letter variable names are discouraged.
Simple enough to fix these... /r/result/ and /a/alternative/
| if __name__ == '__main__': | ||
| args = parse_args() | ||
| main( args ) |
old pull request: GoogleCloudPlatform#826 will add new pull request
yogeshg
commented
Mar 2, 2017
@jonparrott and @gguuss, |
Adding an example for streaming audio. This usecase was missing from Google Cloud Speech API. The documentation was misleading and was updated in PR #3074 for google-cloud-python