| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
|
||
| def _make_async_request(self, content=None, source_uri=None, | ||
| max_alternatives=None): | ||
| client = speech.Client(use_gax=False) |
| profanity_filter=True, | ||
| speech_context=['Google', 'cloud']) | ||
|
|
||
| return result |
| import time | ||
| with open(AUDIO_FILE, 'rb') as file_obj: | ||
| operation = self._make_async_request(content=file_obj.read(), | ||
| max_alternatives=2) |
| self._check_best_results(result) | ||
|
|
||
| def test_async_recognize_local_file(self): | ||
| import time |
| while retry_count > 0 and not operation.complete: | ||
| retry_count -= 1 | ||
| time.sleep(10) | ||
| operation.poll() |
| source_uri = 'gs://%s/%s' % (bucket_name, blob_name) | ||
| operation = self._make_async_request(source_uri=source_uri, | ||
| max_alternatives=2) | ||
| retry_count = 100 |
| retry_count = 100 | ||
| while retry_count > 0 and not operation.complete: | ||
| retry_count -= 1 | ||
| time.sleep(10) |
| results = operation.results | ||
| self.assertIsInstance(results[0], Transcript) | ||
| self.assertEqual(results[0].transcript, 'hello ' + self.ASSERT_TEXT) | ||
| self.assertGreater(results[0].confidence, 0.90) |
| """ | ||
|
|
||
| def _operation_complete(result): | ||
| return result |
| def test_async_recognize_local_file(self): | ||
| import time | ||
| if Config.USE_GAX: | ||
| self.skipTest('async_recognize gRPC not yet implemented.') |
|
LGTM (assuming you are tracking those skipTest usages) |
Sorry, something went wrong.
| :rtype: bool | ||
| :returns: Boolean indicating if the operation is complete. | ||
| """ | ||
|
|
There was a problem hiding this comment.
LGTM provided you are tracking skipTest
Sorry, something went wrong.
|
Ok I'm squashing now. Thanks! |
Sorry, something went wrong.
…est-system-tests Add speech async JSON/REST system tests.
| Back | FazBrowse Home | New Git URL |
This adds JSON/REST system tests for speech's async_recognize() method.