Skip to content

Commit f044dd6

Browse files
gguussJon Wayne Parrott
authored and
Jon Wayne Parrott
committed
Adds new examples, replaces markdown with restructured text [(#945)](GoogleCloudPlatform/python-docs-samples#945)
* Adds new examples, replaces markdown with restructured text * Address review feedback * Use videos from pubilc bucket, update to new client library. * Style nit
1 parent 8a5ce83 commit f044dd6

File tree

4 files changed

+145
-29
lines changed

4 files changed

+145
-29
lines changed

samples/shotchange/README.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

samples/shotchange/README.rst

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
.. This file is automatically generated. Do not edit this file directly.
2+
3+
Google Cloud Video Intelligence API Python Samples
4+
===============================================================================
5+
6+
This directory contains samples for Google Cloud Video Intelligence API. `Google Cloud Video Intelligence API`_ allows developers to easily integrate feature detection in video.
7+
8+
9+
10+
11+
.. _Google Cloud Video Intelligence API: https://cloud.google.com/video-intelligence/docs
12+
13+
Setup
14+
-------------------------------------------------------------------------------
15+
16+
17+
Authentication
18+
++++++++++++++
19+
20+
Authentication is typically done through `Application Default Credentials`_,
21+
which means you do not have to change the code to authenticate as long as
22+
your environment has credentials. You have a few options for setting up
23+
authentication:
24+
25+
#. When running locally, use the `Google Cloud SDK`_
26+
27+
.. code-block:: bash
28+
29+
gcloud auth application-default login
30+
31+
32+
#. When running on App Engine or Compute Engine, credentials are already
33+
set-up. However, you may need to configure your Compute Engine instance
34+
with `additional scopes`_.
35+
36+
#. You can create a `Service Account key file`_. This file can be used to
37+
authenticate to Google Cloud Platform services from any environment. To use
38+
the file, set the ``GOOGLE_APPLICATION_CREDENTIALS`` environment variable to
39+
the path to the key file, for example:
40+
41+
.. code-block:: bash
42+
43+
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service_account.json
44+
45+
.. _Application Default Credentials: https://cloud.google.com/docs/authentication#getting_credentials_for_server-centric_flow
46+
.. _additional scopes: https://cloud.google.com/compute/docs/authentication#using
47+
.. _Service Account key file: https://developers.google.com/identity/protocols/OAuth2ServiceAccount#creatinganaccount
48+
49+
Install Dependencies
50+
++++++++++++++++++++
51+
52+
#. Install `pip`_ and `virtualenv`_ if you do not already have them.
53+
54+
#. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+.
55+
56+
.. code-block:: bash
57+
58+
$ virtualenv env
59+
$ source env/bin/activate
60+
61+
#. Install the dependencies needed to run the samples.
62+
63+
.. code-block:: bash
64+
65+
$ pip install -r requirements.txt
66+
67+
.. _pip: https://pip.pypa.io/
68+
.. _virtualenv: https://virtualenv.pypa.io/
69+
70+
Samples
71+
-------------------------------------------------------------------------------
72+
73+
Shot Change Detection
74+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
75+
76+
77+
78+
To run this sample:
79+
80+
.. code-block:: bash
81+
82+
$ python shotchange.py
83+
84+
usage: shotchange.py [-h] path
85+
86+
This application demonstrates how to perform basic operations with the
87+
Google Cloud Video Intelligence API.
88+
89+
For more information, check out the documentation at
90+
https://cloud.google.com/videointelligence/docs.
91+
92+
Example Usage:
93+
94+
python shotchange.py gs://cloudmleap/video/googlework.mp4
95+
96+
positional arguments:
97+
path GCS path for shot change detection.
98+
99+
optional arguments:
100+
-h, --help show this help message and exit
101+
102+
103+
104+
105+
The client library
106+
-------------------------------------------------------------------------------
107+
108+
This sample uses the `Google Cloud Client Library for Python`_.
109+
You can read the documentation for more details on API usage and use GitHub
110+
to `browse the source`_ and `report issues`_.
111+
112+
.. Google Cloud Client Library for Python:
113+
https://googlecloudplatform.github.io/google-cloud-python/
114+
.. browse the source:
115+
https://github.com/GoogleCloudPlatform/google-cloud-python
116+
.. report issues:
117+
https://github.com/GoogleCloudPlatform/google-cloud-python/issues
118+
119+
120+
.. _Google Cloud SDK: https://cloud.google.com/sdk/

samples/shotchange/README.rst.in

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# This file is used to generate README.rst
2+
3+
product:
4+
name: Google Cloud Video Intelligence API
5+
short_name: Cloud Video Intelligence API
6+
url: https://cloud.google.com/video-intelligence/docs
7+
description: >
8+
`Google Cloud Video Intelligence API`_ allows developers to easily
9+
integrate feature detection in video.
10+
11+
setup:
12+
- auth
13+
- install_deps
14+
15+
samples:
16+
- name: Shot Change Detection
17+
file: shotchange.py
18+
show_help: True
19+
20+
cloud_client_library: true

samples/shotchange/shotchange.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
2020
For more information, check out the documentation at
2121
https://cloud.google.com/videointelligence/docs.
22+
23+
Example Usage:
24+
25+
python shotchange.py gs://cloudmleap/video/googlework.mp4
26+
2227
"""
2328

2429
# [START full_tutorial]

0 commit comments

Comments
 (0)