def request_stream(data_stream, rate, interim_results=True):
 recognition_config = cloud_speech_pb2.RecognitionConfig(encoding='LINEAR16', sample_rate=rate, language_code='en-US')
 streaming_config = cloud_speech_pb2.StreamingRecognitionConfig(interim_results=interim_results, config=recognition_config)
 (yield cloud_speech_pb2.StreamingRecognizeRequest(streaming_config=streaming_config))
 for data in data_stream:
  (yield cloud_speech_pb2.StreamingRecognizeRequest(audio_content=data))

def request_stream ( data_stream , rate , interim_results = True ) : recognition_config = cloud_speech_pb2 . RecognitionConfig ( encoding = 'LINEAR16' , sample_rate = rate , language_code = 'en-US' ) streaming_config = cloud_speech_pb2 . StreamingRecognitionConfig ( interim_results = interim_results , config = recognition_config ) ( yield cloud_speech_pb2 . StreamingRecognizeRequest ( streaming_config = streaming_config ) ) for data in data_stream : ( yield cloud_speech_pb2 . StreamingRecognizeRequest ( audio_content = data ) )
yields streamingrecognizerequests constructed from a recording audio stream .