Skip to content

Commit 5e78b33

Browse files
authored
Video Intelligence region tag update (#1639)
1 parent 4831bba commit 5e78b33

File tree

5 files changed

+30
-30
lines changed

5 files changed

+30
-30
lines changed

video/cloud-client/analyze/analyze.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def analyze_labels(path):
136136

137137

138138
def analyze_labels_file(path):
139-
# [START video_analyze_labels_local]
139+
# [START video_analyze_labels]
140140
"""Detect labels given a file path."""
141141
video_client = videointelligence.VideoIntelligenceServiceClient()
142142
features = [videointelligence.enums.Feature.LABEL_DETECTION]
@@ -207,7 +207,7 @@ def analyze_labels_file(path):
207207
print('\tFirst frame time offset: {}s'.format(time_offset))
208208
print('\tFirst frame confidence: {}'.format(frame.confidence))
209209
print('\n')
210-
# [END video_analyze_labels_local]
210+
# [END video_analyze_labels]
211211

212212

213213
def analyze_shots(path):

video/cloud-client/analyze/beta_snippets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from google.cloud import videointelligence_v1p1beta1 as videointelligence
2828

2929

30-
# [START video_speech_transcription]
30+
# [START video_speech_transcription_gcs_beta]
3131
def speech_transcription(input_uri):
3232
"""Transcribe speech from a video stored on GCS."""
3333
video_client = videointelligence.VideoIntelligenceServiceClient()
@@ -66,7 +66,7 @@ def speech_transcription(input_uri):
6666
start_time.seconds + start_time.nanos * 1e-9,
6767
end_time.seconds + end_time.nanos * 1e-9,
6868
word))
69-
# [END video_speech_transcription]
69+
# [END video_speech_transcription_gcs_beta]
7070

7171

7272
if __name__ == '__main__':

video/cloud-client/labels/labels.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,29 @@
2727
2828
"""
2929

30-
# [START full_tutorial]
31-
# [START imports]
30+
# [START video_label_tutorial]
31+
# [START video_label_tutorial_imports]
3232
import argparse
3333

3434
from google.cloud import videointelligence
35-
# [END imports]
35+
# [END video_label_tutorial_imports]
3636

3737

3838
def analyze_labels(path):
3939
""" Detects labels given a GCS path. """
40-
# [START construct_request]
40+
# [START video_label_tutorial_construct_request]
4141
video_client = videointelligence.VideoIntelligenceServiceClient()
4242
features = [videointelligence.enums.Feature.LABEL_DETECTION]
4343
operation = video_client.annotate_video(path, features=features)
44-
# [END construct_request]
44+
# [END video_label_tutorial_construct_request]
4545
print('\nProcessing video for label annotations:')
4646

47-
# [START check_operation]
47+
# [START video_label_tutorial_check_operation]
4848
result = operation.result(timeout=90)
4949
print('\nFinished processing.')
50-
# [END check_operation]
50+
# [END video_label_tutorial_check_operation]
5151

52-
# [START parse_response]
52+
# [START video_label_tutorial_parse_response]
5353
segment_labels = result.annotation_results[0].segment_label_annotations
5454
for i, segment_label in enumerate(segment_labels):
5555
print('Video label description: {}'.format(
@@ -68,17 +68,17 @@ def analyze_labels(path):
6868
print('\tSegment {}: {}'.format(i, positions))
6969
print('\tConfidence: {}'.format(confidence))
7070
print('\n')
71-
# [END parse_response]
71+
# [END video_label_tutorial_parse_response]
7272

7373

7474
if __name__ == '__main__':
75-
# [START running_app]
75+
# [START video_label_tutorial_run_application]
7676
parser = argparse.ArgumentParser(
7777
description=__doc__,
7878
formatter_class=argparse.RawDescriptionHelpFormatter)
7979
parser.add_argument('path', help='GCS file path for label detection.')
8080
args = parser.parse_args()
8181

8282
analyze_labels(args.path)
83-
# [END running_app]
84-
# [END full_tutorial]
83+
# [END video_label_tutorial_run_application]
84+
# [END video_label_tutorial]

video/cloud-client/quickstart/quickstart.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525

2626
def run_quickstart():
27-
# [START videointelligence_quickstart]
27+
# [START video_quickstart]
2828
from google.cloud import videointelligence
2929

3030
video_client = videointelligence.VideoIntelligenceServiceClient()
@@ -55,7 +55,7 @@ def run_quickstart():
5555
print('\tSegment {}: {}'.format(i, positions))
5656
print('\tConfidence: {}'.format(confidence))
5757
print('\n')
58-
# [END videointelligence_quickstart]
58+
# [END video_quickstart]
5959

6060

6161
if __name__ == '__main__':

video/cloud-client/shotchange/shotchange.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,46 +26,46 @@
2626
2727
"""
2828

29-
# [START full_tutorial]
30-
# [START imports]
29+
# [START video_shot_tutorial]
30+
# [START video_shot_tutorial_imports]
3131
import argparse
3232

3333
from google.cloud import videointelligence
34-
# [END imports]
34+
# [END video_shot_tutorial_imports]
3535

3636

3737
def analyze_shots(path):
3838
""" Detects camera shot changes. """
39-
# [START construct_request]
39+
# [START video_shot_tutorial_construct_request]
4040
video_client = videointelligence.VideoIntelligenceServiceClient()
4141
features = [videointelligence.enums.Feature.SHOT_CHANGE_DETECTION]
4242
operation = video_client.annotate_video(path, features=features)
43-
# [END construct_request]
43+
# [END video_shot_tutorial_construct_request]
4444
print('\nProcessing video for shot change annotations:')
4545

46-
# [START check_operation]
46+
# [START video_shot_tutorial_check_operation]
4747
result = operation.result(timeout=90)
4848
print('\nFinished processing.')
49-
# [END check_operation]
49+
# [END video_shot_tutorial_check_operation]
5050

51-
# [START parse_response]
51+
# [START video_shot_tutorial_parse_response]
5252
for i, shot in enumerate(result.annotation_results[0].shot_annotations):
5353
start_time = (shot.start_time_offset.seconds +
5454
shot.start_time_offset.nanos / 1e9)
5555
end_time = (shot.end_time_offset.seconds +
5656
shot.end_time_offset.nanos / 1e9)
5757
print('\tShot {}: {} to {}'.format(i, start_time, end_time))
58-
# [END parse_response]
58+
# [END video_shot_tutorial_parse_response]
5959

6060

6161
if __name__ == '__main__':
62-
# [START running_app]
62+
# [START video_shot_tutorial_run_application]
6363
parser = argparse.ArgumentParser(
6464
description=__doc__,
6565
formatter_class=argparse.RawDescriptionHelpFormatter)
6666
parser.add_argument('path', help='GCS path for shot change detection.')
6767
args = parser.parse_args()
6868

6969
analyze_shots(args.path)
70-
# [END running_app]
71-
# [END full_tutorial]
70+
# [END video_shot_tutorial_run_application]
71+
# [END video_shot_tutorial]

0 commit comments

Comments
 (0)