Skip to content

Commit 0cedabb

Browse files
averikitschdanoscarmike
authored andcommitted
1 parent af202da commit 0cedabb

File tree

1 file changed

+8
-0
lines changed
  • packages/google-cloud-videointelligence/samples/analyze

1 file changed

+8
-0
lines changed

packages/google-cloud-videointelligence/samples/analyze/analyze.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434

3535
def analyze_explicit_content(path):
36+
# [START video_analyze_explicit_content]
3637
""" Detects explicit content from the GCS path to a video. """
3738
video_client = videointelligence.VideoIntelligenceServiceClient()
3839
features = [videointelligence.enums.Feature.EXPLICIT_CONTENT_DETECTION]
@@ -52,9 +53,11 @@ def analyze_explicit_content(path):
5253
print('Time: {}s'.format(frame_time))
5354
print('\tpornography: {}'.format(
5455
likely_string[frame.pornography_likelihood]))
56+
# [END video_analyze_explicit_content]
5557

5658

5759
def analyze_labels(path):
60+
# [START video_analyze_labels_gcs]
5861
""" Detects labels given a GCS path. """
5962
video_client = videointelligence.VideoIntelligenceServiceClient()
6063
features = [videointelligence.enums.Feature.LABEL_DETECTION]
@@ -129,9 +132,11 @@ def analyze_labels(path):
129132
print('\tFirst frame time offset: {}s'.format(time_offset))
130133
print('\tFirst frame confidence: {}'.format(frame.confidence))
131134
print('\n')
135+
# [END video_analyze_labels_gcs]
132136

133137

134138
def analyze_labels_file(path):
139+
# [START video_analyze_labels_local]
135140
"""Detect labels given a file path."""
136141
video_client = videointelligence.VideoIntelligenceServiceClient()
137142
features = [videointelligence.enums.Feature.LABEL_DETECTION]
@@ -202,9 +207,11 @@ def analyze_labels_file(path):
202207
print('\tFirst frame time offset: {}s'.format(time_offset))
203208
print('\tFirst frame confidence: {}'.format(frame.confidence))
204209
print('\n')
210+
# [END video_analyze_labels_local]
205211

206212

207213
def analyze_shots(path):
214+
# [START video_analyze_shots]
208215
""" Detects camera shot changes. """
209216
video_client = videointelligence.VideoIntelligenceServiceClient()
210217
features = [videointelligence.enums.Feature.SHOT_CHANGE_DETECTION]
@@ -221,6 +228,7 @@ def analyze_shots(path):
221228
end_time = (shot.end_time_offset.seconds +
222229
shot.end_time_offset.nanos / 1e9)
223230
print('\tShot {}: {} to {}'.format(i, start_time, end_time))
231+
# [END video_analyze_shots]
224232

225233

226234
if __name__ == '__main__':

0 commit comments

Comments
 (0)