Skip to content

Commit a4cfe84

Browse files
authored
videointelligence: Harmonize / DRY 'README.rst' / 'docs/index.rst'. (#6002)
1 parent 1841c7a commit a4cfe84

2 files changed

Lines changed: 82 additions & 111 deletions

File tree

videointelligence/README.rst

Lines changed: 76 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,95 @@
11
Python Client for Google Cloud Video Intelligence
22
=================================================
33

4-
Python idiomatic client for `Google Cloud Video Intelligence`_
4+
|pypi| |versions|
55

6-
.. _Google Cloud Video Intelligence: https://cloud.google.com/video-intelligence/
6+
`Google Cloud Video Intelligence`_ API makes videos searchable, and
7+
discoverable, by extracting metadata with an easy to use API.
8+
You can now search every moment of every video file in your catalog
9+
and find every occurrence as well as its significance. It quickly
10+
annotates videos stored in `Google Cloud Storage`_, and helps you
11+
identify key nouns entities of your video, and when they occur
12+
within the video. Separate signal from noise, by retrieving
13+
relevant information at the video, shot or per frame.
714

8-
|pypi| |versions|
15+
- `Client Library Documentation`_
16+
- `Product Documentation`_
17+
18+
.. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-videointelligence.svg
19+
:target: https://pypi.org/project/google-cloud-videointelligence/
20+
.. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-videointelligence.svg
21+
:target: https://pypi.org/project/google-cloud-videointelligence/
22+
.. _Google Cloud Video Intelligence: https://cloud.google.com/video-intelligence/
23+
.. _Google Cloud Storage: https://cloud.google.com/storage/
24+
.. _Client Library Documentation: https://googlecloudplatform.github.io/google-cloud-python/latest/datastore/index.html
25+
.. _Product Documentation: https://cloud.google.com/video-intelligence/docs/
926

1027
Quick Start
1128
-----------
1229

13-
.. code-block:: console
30+
In order to use this library, you first need to go through the following steps:
1431

15-
$ pip install --upgrade google-cloud-videointelligence
32+
1. `Select or create a Cloud Platform project.`_
33+
2. `Enable billing for your project.`_
34+
3. `Enable the Google Cloud Video Intelligence API.`_
35+
4. `Setup Authentication.`_
1636

17-
For more information on setting up your Python development environment,
18-
such as installing ``pip`` and ``virtualenv`` on your system, please refer
19-
to `Python Development Environment Setup Guide`_ for Google Cloud Platform.
37+
.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
38+
.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
39+
.. _Enable the Google Cloud Video Intelligence API.: https://cloud.google.com/datastore
40+
.. _Setup Authentication.: https://googlecloudplatform.github.io/google-cloud-python/latest/core/auth.html
2041

21-
.. _Python Development Environment Setup Guide: https://cloud.google.com/python/setup
42+
Installation
43+
~~~~~~~~~~~~
2244

23-
Authentication
24-
--------------
45+
Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to
46+
create isolated Python environments. The basic problem it addresses is one of
47+
dependencies and versions, and indirectly permissions.
2548

26-
With ``google-cloud-python`` we try to make authentication as painless as
27-
possible. Check out the `Authentication section`_ in our documentation to
28-
learn more. You may also find the `authentication document`_ shared by all
29-
the ``google-cloud-*`` libraries to be helpful.
49+
With `virtualenv`_, it's possible to install this library without needing system
50+
install permissions, and without clashing with the installed system
51+
dependencies.
3052

31-
.. _Authentication section: https://google-cloud-python.readthedocs.io/en/latest/core/auth.html
32-
.. _authentication document: https://github.com/GoogleCloudPlatform/google-cloud-common/tree/master/authentication
53+
.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/
3354

34-
Using the API
35-
-------------
55+
Mac/Linux
56+
^^^^^^^^^
3657

37-
The Google Cloud `Video Intelligence`_ (`Video Intelligence API docs`_)
38-
API enables developers to
39-
understand the content of a video by encapsulating powerful machine
40-
learning models in an easy to use REST API.
58+
.. code-block:: console
4159
42-
.. _Video Intelligence: https://cloud.google.com/video-intelligence/
43-
.. _Video Intelligence API docs: https://cloud.google.com/video-intelligence/docs/reference/rest/
60+
pip install virtualenv
61+
virtualenv <your-env>
62+
source <your-env>/bin/activate
63+
<your-env>/bin/pip install google-cloud-datastore
4464
45-
.. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-videointelligence.svg
46-
:target: https://pypi.org/project/google-cloud-videointelligence/
47-
.. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-videointelligence.svg
48-
:target: https://pypi.org/project/google-cloud-videointelligence/
65+
Windows
66+
^^^^^^^
67+
68+
.. code-block:: console
69+
70+
pip install virtualenv
71+
virtualenv <your-env>
72+
<your-env>\Scripts\activate
73+
<your-env>\Scripts\pip.exe install google-cloud-datastore
74+
75+
Example Usage
76+
~~~~~~~~~~~~~
77+
78+
.. code-block:: python
79+
80+
from google.cloud import videointelligence
81+
82+
client = videointelligence.VideoIntelligenceServiceClient()
83+
job = client.annotate_video(
84+
input_uri='gs://<bucket-name>/my_video.mp4',
85+
features=['LABEL_DETECTION', 'SHOT_CHANGE_DETECTION'],
86+
)
87+
result = job.result()
88+
89+
Next Steps
90+
~~~~~~~~~~
91+
92+
- Read the `Client Library Documentation`_ for Google Cloud Video Intelligence
93+
API to see other available methods on the client.
94+
- Read the `Product documentation`_ to learn
95+
more about the product and see How-to Guides.

videointelligence/docs/index.rst

Lines changed: 6 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,7 @@
1-
Video Intelligence
2-
==================
1+
.. include:: /../videointelligence/README.rst
32

4-
`Google Cloud Video Intelligence`_ API makes videos searchable, and
5-
discoverable, by extracting metadata with an easy to use API.
6-
You can now search every moment of every video file in your catalog
7-
and find every occurrence as well as its significance. It quickly
8-
annotates videos stored in `Google Cloud Storage`_, and helps you
9-
identify key nouns entities of your video, and when they occur
10-
within the video. Separate signal from noise, by retrieving
11-
relevant information at the video, shot or per frame.
12-
13-
.. _Google Cloud Video Intelligence: https://cloud.google.com/video-intelligence/
14-
.. _Google Cloud Storage: https://cloud.google.com/storage/
15-
16-
************
17-
Installation
18-
************
19-
20-
Install the ``google-cloud-videointelligence`` library using ``pip``:
21-
22-
.. code-block:: console
23-
24-
$ pip install google-cloud-videointelligence
25-
26-
27-
********************************
28-
Authentication and Configuration
29-
********************************
30-
31-
- For an overview of authentication in ``google-cloud-python``,
32-
see :doc:`/core/auth`.
33-
34-
- In addition to any authentication configuration, you should also set the
35-
:envvar:`GOOGLE_CLOUD_PROJECT` environment variable for the project you'd
36-
like to interact with. If the :envvar:`GOOGLE_CLOUD_PROJECT` environment
37-
variable is not present, the project ID from JSON file credentials is used.
38-
39-
If you are using Google App Engine or Google Compute Engine
40-
this will be detected automatically.
41-
42-
- After configuring your environment, create a
43-
:class:`~google.cloud.videointelligence_v1.VideoIntelligenceServiceClient`.
44-
45-
.. code-block:: python
46-
47-
>>> from google.cloud import videointelligence
48-
>>> client = videointelligence.VideoIntelligenceServiceClient()
49-
50-
or pass in ``credentials`` explicitly.
51-
52-
.. code-block:: python
53-
54-
>>> from google.cloud import videointelligence
55-
>>> client = videointelligence.VideoIntelligenceServiceClient(
56-
... credentials=creds,
57-
... )
58-
59-
60-
******************
61-
Annotating a Video
62-
******************
63-
64-
To annotate a video, just determine which annotation features you want, and point
65-
the API at your video:
66-
67-
.. code-block:: python
68-
69-
>>> from google.cloud import videointelligence
70-
>>>
71-
>>> client = videointelligence.VideoIntelligenceServiceClient()
72-
>>> result = client.annotate_video(
73-
... input_uri='gs://cloudmleap/video/next/animals.mp4',
74-
... features=['LABEL_DETECTION', 'SHOT_CHANGE_DETECTION'],
75-
... ).result()
76-
>>> result.annotationResults[0].labelAnnotations[0].description
77-
'Android'
78-
>>> result.annotationResults[0].labelAnnotations[1].description
79-
'Animation'
80-
81-
82-
*************
833
API Reference
84-
*************
4+
-------------
855

866

877
This package includes clients for multiple versions of the Video Intelligence
@@ -124,6 +44,10 @@ An API and type reference is provided the these betas also:
12444
gapic/v1beta2/api
12545
gapic/v1beta2/types
12646

47+
48+
Changelog
49+
---------
50+
12751
For a list of all ``google-cloud-videointelligence`` releases:
12852

12953
.. toctree::

0 commit comments

Comments
 (0)