GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Add speech async gapic by daspecster · Pull Request #2663 · googleapis/google-cloud-python Conversation
|
| REQUIREMENTS = [ | ||
| 'google-cloud-core >= 0.20.0', | ||
| 'grpcio >= 1.0.0, < 2.0dev', | ||
| 'google-gax >= 0.14.1, < 0.15dev', |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
0ca8559 to
bf805e3
Compare
| from google.cloud._helpers import make_secure_stub | ||
| from google.cloud.connection import DEFAULT_USER_AGENT | ||
| from google.cloud.speech.operation import Operation | ||
| from google.cloud.operation import register_type |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| OPERATIONS_API_HOST = 'speech.googleapis.com' | ||
|
|
||
| register_type(AsyncRecognizeMetadata) | ||
| register_type(AsyncRecognizeResponse) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| words to the vocabulary of the recognizer. | ||
|
|
||
| :raises NotImplementedError: Always. | ||
| :rtype: :class:`~google.cloud.operation.Opeartion` |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| api = self._gapic_api | ||
| response = api.async_recognize(config=config, audio=audio) | ||
|
|
||
| self._client._operations_stub = make_secure_stub( |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| REQUIREMENTS = [ | ||
| 'google-cloud-core >= 0.20.0', | ||
| 'gapic-google-cloud-speech-v1beta1 >= 0.11.1, < 0.12.0', | ||
| 'grpc-google-cloud-speech-v1beta1 >= 0.11.1, < 0.12.0', |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| credentials = _Credentials() | ||
| client = self._makeOne(credentials=credentials, use_gax=True) | ||
| client.connection = _Connection() | ||
| _MockGAPICSpeechAPI._results = [] |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| credentials = _Credentials() | ||
| client = self._makeOne(credentials=credentials) | ||
| client.connection = _Connection() | ||
| client.connection.credentials = credentials |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| operation = client.async_recognize(sample) | ||
|
|
||
| self.assertFalse(operation.complete) | ||
| self.assertIsNone(operation.response) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
|
|
||
| class _MockGAPICMetadata(object): | ||
| type_url = None |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
375feeb to
2e9f486
Compare
|
@dhermes I think there are just thow two open questions. Did you have anything else? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| @staticmethod | ||
| def _make_result(transcript, confidence): | ||
| from google.cloud.grpc.speech.v1beta1 import cloud_speech_pb2 | ||
| return cloud_speech_pb2.SpeechRecognitionResult( |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| alternatives=[ | ||
| cloud_speech_pb2.SpeechRecognitionAlternative( | ||
| transcript=transcript, | ||
| confidence=confidence, |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| def _make_sync_response(self, *results): | ||
| from google.cloud.grpc.speech.v1beta1 import cloud_speech_pb2 | ||
| response = cloud_speech_pb2.SyncRecognizeResponse( |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| from google.cloud.speech import _gax as MUT | ||
|
|
||
| from google.cloud import speech | ||
| from google.cloud.speech import _gax as MUT |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| client.connection = _Connection() | ||
| client.connection.credentials = credentials | ||
|
|
||
| _MockGAPICSpeechAPI._response = self._make_sync_response() |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| credentials = _Credentials() | ||
| client = self._makeOne(credentials=credentials) | ||
| client.connection = _Connection() | ||
| client.connection.credentials = credentials |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| mock_response = self._response | ||
| mock_response.results = self._results | ||
| return mock_response | ||
| # self._response.results = self._results |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| _results = None | ||
|
|
||
| def async_recognize(self, config, audio): | ||
| from google.longrunning.operations_pb2 import Operation |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| "confidence": 0.9224355 | ||
| }, { | ||
| "transcript": 'testing 4 5 6', | ||
| "confidence": 0.0123456 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| with self.assertRaises(ValueError): | ||
| with _Monkey(MUT, SpeechApi=_MockGAPICSpeechAPI): | ||
| with _Monkey(_gax, SpeechApi=speech_api): |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| self.assertEqual(results[1].transcript, | ||
| alternatives[1]['transcript']) | ||
| self.assertEqual(results[1].confidence, | ||
| alternatives[1]['confidence']) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM provided you clear up my most recent comments and resolve the setup.py question for @jonparrott
Sorry, something went wrong.
There was an error while loading. Please reload this page.
77b6d16 to
5d4272f
Compare
|
Travis has gone on strike again... |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Finally travis ran this job. @dhermes, I'm merging(in 15minutes) since I got your suggestions in. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Feel free to merge now |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…apic Add speech async gapic
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.