|
1 |
| -Python Client for Google Cloud Speech API (`Beta`_) |
2 |
| -==================================================== |
3 |
| - |
4 |
| -`Google Cloud Speech API`_: Google Cloud Speech API. |
5 |
| - |
6 |
| -- `Client Library Documentation`_ |
7 |
| -- `Product Documentation`_ |
8 |
| - |
9 |
| -.. _Alpha: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst |
10 |
| -.. _Google Cloud Speech API: https://cloud.google.com/speech |
11 |
| -.. _Client Library Documentation: https://googlecloudplatform.github.io/google-cloud-python/stable/speech/usage.html |
12 |
| -.. _Product Documentation: https://cloud.google.com/speech |
13 |
| - |
14 |
| -Quick Start |
15 |
| ------------ |
16 |
| - |
17 |
| -In order to use this library, you first need to go through the following steps: |
18 |
| - |
19 |
| -1. `Select or create a Cloud Platform project.`_ |
20 |
| -2. `Enable billing for your project.`_ |
21 |
| -3. `Enable the Google Cloud Speech API.`_ |
22 |
| -4. `Setup Authentication.`_ |
23 |
| - |
24 |
| -.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project |
25 |
| -.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project |
26 |
| -.. _Enable the Google Cloud Speech API.: https://cloud.google.com/speech |
27 |
| -.. _Setup Authentication.: https://googlecloudplatform.github.io/google-cloud-python/stable/core/auth.html |
28 |
| - |
29 |
| -Installation |
30 |
| -~~~~~~~~~~~~ |
31 |
| - |
32 |
| -Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to |
33 |
| -create isolated Python environments. The basic problem it addresses is one of |
34 |
| -dependencies and versions, and indirectly permissions. |
35 |
| - |
36 |
| -With `virtualenv`_, it's possible to install this library without needing system |
37 |
| -install permissions, and without clashing with the installed system |
38 |
| -dependencies. |
39 |
| - |
40 |
| -.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ |
41 |
| - |
42 |
| - |
43 |
| -Mac/Linux |
44 |
| -^^^^^^^^^ |
45 |
| - |
46 |
| -.. code-block:: console |
47 |
| -
|
48 |
| - pip install virtualenv |
49 |
| - virtualenv <your-env> |
50 |
| - source <your-env>/bin/activate |
51 |
| - <your-env>/bin/pip install google-cloud-speech |
52 |
| -
|
53 |
| -
|
54 |
| -Windows |
55 |
| -^^^^^^^ |
56 |
| - |
57 |
| -.. code-block:: console |
58 |
| -
|
59 |
| - pip install virtualenv |
60 |
| - virtualenv <your-env> |
61 |
| - <your-env>\Scripts\activate |
62 |
| - <your-env>\Scripts\pip.exe install google-cloud-speech |
63 |
| -
|
64 |
| -Preview |
65 |
| -~~~~~~~ |
66 |
| - |
67 |
| -SpeechClient |
68 |
| -^^^^^^^^^^^^ |
69 |
| - |
70 |
| -.. code:: py |
71 |
| -
|
72 |
| - from google.cloud import speech_v1 |
73 |
| - from google.cloud.speech_v1 import enums |
74 |
| -
|
75 |
| - client = speech_v1.SpeechClient() |
76 |
| -
|
77 |
| - encoding = enums.RecognitionConfig.AudioEncoding.FLAC |
78 |
| - sample_rate_hertz = 44100 |
79 |
| - language_code = 'en-US' |
80 |
| - config = {'encoding': encoding, 'sample_rate_hertz': sample_rate_hertz, 'language_code': language_code} |
81 |
| - uri = 'gs://bucket_name/file_name.flac' |
82 |
| - audio = {'uri': uri} |
83 |
| -
|
84 |
| - response = client.recognize(config, audio) |
85 |
| -
|
86 |
| -Next Steps |
87 |
| -~~~~~~~~~~ |
88 |
| - |
89 |
| -- Read the `Client Library Documentation`_ for Google Cloud Speech API |
90 |
| - API to see other available methods on the client. |
91 |
| -- Read the `Google Cloud Speech API Product documentation`_ to learn |
92 |
| - more about the product and see How-to Guides. |
93 |
| -- View this `repository’s main README`_ to see the full list of Cloud |
94 |
| - APIs that we cover. |
95 |
| - |
96 |
| -.. _Google Cloud Speech API Product documentation: https://cloud.google.com/speech |
97 |
| -.. _repository’s main README: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst |
| 1 | +.. include:: /../asset/README.rst |
98 | 2 |
|
99 | 3 | Api Reference
|
100 | 4 | -------------
|
|
0 commit comments