Uh oh!
There was an error while loading. Please reload this page.
Minute workaround - #834
Conversation
| @@ -0,0 +1,294 @@ | |||
| #!/usr/bin/python | |||
| # Copyright (C) 2016 Google Inc. | |||
There was a problem hiding this comment.
Nit: blank new lines between shebang and license and license and docstring.
| # Create a secure channel using the credentials. | ||
| http_request = google.auth.transport.requests.Request() | ||
| target = '{}:{}'.format(host, port) |
There was a problem hiding this comment.
You don't need to use the port anymore.
| credentials, http_request, target) | ||
| def _audio_data_generator(buff, overlap_buffer): |
There was a problem hiding this comment.
why not just use buffer instead of buff?
There was a problem hiding this comment.
I feel like we've had this conversation before :) buffer turns out to be a reserved word.
There was a problem hiding this comment.
oh my god we totally have. Thanks.
| """A generator that yields all available data in the given buffer. | ||
| Args: | ||
| buff - a Queue object, where each element is a chunk of data. |
There was a problem hiding this comment.
Napoleon style is:
Args:
buff (Queue): ...
overlap_buffer (type): ...
Yields:
bytes: Achunkofdata ...| def _fill_buffer(buff, in_data, frame_count, time_info, status_flags): | ||
| """Continuously collect data from the audio stream, into the buffer.""" |
| recognize_stream = service.StreamingRecognize( | ||
| requests, DEADLINE_SECS) | ||
| except grpc.RpcError, e: |
There was a problem hiding this comment.
as e, but if you're not going to use it just do except grpc.RpcError:
| if __name__ == '__main__': | ||
| parser = argparse.ArgumentParser() | ||
| parser.add_argument( | ||
| '-v', '--verbose', help='increase output verbosity', |
jerjou
commented
Mar 1, 2017
Oh right - tests. Good idea. Comments addressed - PTAL. |
theacodes
left a comment
There was a problem hiding this comment.
I still don't see tests?
| @@ -0,0 +1,296 @@ | |||
| #!/usr/bin/python | |||
| # Copyright (C) 2016 Google Inc. | |||
| # 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 streams audio to the Google Cloud Speech API via GRPC. |
There was a problem hiding this comment.
nit nit: I wanted a blank newline between the license and this too. :)
249e47f to
5900d39Comparejerjou
commented
Mar 1, 2017
Doh. Forgot to |
jerjou
commented
Mar 1, 2017
Oh wait. travis is unhappy. Bide... |
jerjou
commented
Mar 1, 2017
Placated travis. @dpebot would you mind merging if Travis approves? |
A sample for reopening a streaming connection to the speech api, to get around the 1-minute time limit for streaming speech requests.
Addresses #517