From c0d4b5c66ac7ab8ac10efecea6aa248494aff120 Mon Sep 17 00:00:00 2001 From: Alix Hamilton Date: Wed, 15 Aug 2018 14:26:50 -0700 Subject: [PATCH 1/5] updates region tags for analyze-labels page --- video/cloud-client/analyze/analyze.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/video/cloud-client/analyze/analyze.py b/video/cloud-client/analyze/analyze.py index 0da47657ae4..1905c0e712f 100644 --- a/video/cloud-client/analyze/analyze.py +++ b/video/cloud-client/analyze/analyze.py @@ -136,7 +136,7 @@ def analyze_labels(path): def analyze_labels_file(path): - # [START video_analyze_labels_local] + # [START video_analyze_labels] """Detect labels given a file path.""" video_client = videointelligence.VideoIntelligenceServiceClient() features = [videointelligence.enums.Feature.LABEL_DETECTION] @@ -207,7 +207,7 @@ def analyze_labels_file(path): print('\tFirst frame time offset: {}s'.format(time_offset)) print('\tFirst frame confidence: {}'.format(frame.confidence)) print('\n') - # [END video_analyze_labels_local] + # [END video_analyze_labels] def analyze_shots(path): From 7a01c153e054f698c499305f5ec1aaf2374fdf9e Mon Sep 17 00:00:00 2001 From: Alix Hamilton Date: Wed, 15 Aug 2018 14:27:49 -0700 Subject: [PATCH 2/5] updates region tags for label detection tutorial --- video/cloud-client/labels/labels.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/video/cloud-client/labels/labels.py b/video/cloud-client/labels/labels.py index 7721f36439e..4a1cf7679ec 100644 --- a/video/cloud-client/labels/labels.py +++ b/video/cloud-client/labels/labels.py @@ -27,29 +27,29 @@ """ -# [START full_tutorial] -# [START imports] +# [START video_label_tutorial] +# [START video_label_tutorial_imports] import argparse from google.cloud import videointelligence -# [END imports] +# [END video_label_tutorial_imports] def analyze_labels(path): """ Detects labels given a GCS path. """ - # [START construct_request] + # [START video_label_tutorial_construct_request] video_client = videointelligence.VideoIntelligenceServiceClient() features = [videointelligence.enums.Feature.LABEL_DETECTION] operation = video_client.annotate_video(path, features=features) - # [END construct_request] + # [END video_label_tutorial_construct_request] print('\nProcessing video for label annotations:') - # [START check_operation] + # [START video_label_tutorial_check_operation] result = operation.result(timeout=90) print('\nFinished processing.') - # [END check_operation] + # [END video_label_tutorial_check_operation] - # [START parse_response] + # [START video_label_tutorial_parse_response] segment_labels = result.annotation_results[0].segment_label_annotations for i, segment_label in enumerate(segment_labels): print('Video label description: {}'.format( @@ -68,11 +68,11 @@ def analyze_labels(path): print('\tSegment {}: {}'.format(i, positions)) print('\tConfidence: {}'.format(confidence)) print('\n') - # [END parse_response] + # [END video_label_tutorial_parse_response] if __name__ == '__main__': - # [START running_app] + # [START video_label_tutorial_run_application] parser = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) @@ -80,5 +80,5 @@ def analyze_labels(path): args = parser.parse_args() analyze_labels(args.path) - # [END running_app] -# [END full_tutorial] + # [END video_label_tutorial_run_application] +# [END video_label_tutorial] From 2d426071a95b7fb98937d75b7df52478e41093a0 Mon Sep 17 00:00:00 2001 From: Alix Hamilton Date: Wed, 15 Aug 2018 14:33:10 -0700 Subject: [PATCH 3/5] updates region tags for analyze-labels page --- video/cloud-client/quickstart/quickstart.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/video/cloud-client/quickstart/quickstart.py b/video/cloud-client/quickstart/quickstart.py index e6a196480d3..087f7abd5db 100644 --- a/video/cloud-client/quickstart/quickstart.py +++ b/video/cloud-client/quickstart/quickstart.py @@ -24,7 +24,7 @@ def run_quickstart(): - # [START videointelligence_quickstart] + # [START video_quickstart] from google.cloud import videointelligence video_client = videointelligence.VideoIntelligenceServiceClient() @@ -55,7 +55,7 @@ def run_quickstart(): print('\tSegment {}: {}'.format(i, positions)) print('\tConfidence: {}'.format(confidence)) print('\n') - # [END videointelligence_quickstart] + # [END video_quickstart] if __name__ == '__main__': From 95972200b41dee97ebc658f45acfbafb48b56316 Mon Sep 17 00:00:00 2001 From: Alix Hamilton Date: Wed, 15 Aug 2018 14:40:13 -0700 Subject: [PATCH 4/5] updates region tags for shot change tutorial --- video/cloud-client/shotchange/shotchange.py | 24 ++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/video/cloud-client/shotchange/shotchange.py b/video/cloud-client/shotchange/shotchange.py index 286838ca7f5..e9b91dfd316 100644 --- a/video/cloud-client/shotchange/shotchange.py +++ b/video/cloud-client/shotchange/shotchange.py @@ -26,40 +26,40 @@ """ -# [START full_tutorial] -# [START imports] +# [START video_shot_tutorial] +# [START video_shot_tutorial_imports] import argparse from google.cloud import videointelligence -# [END imports] +# [END video_shot_tutorial_imports] def analyze_shots(path): """ Detects camera shot changes. """ - # [START construct_request] + # [START video_shot_tutorial_construct_request] video_client = videointelligence.VideoIntelligenceServiceClient() features = [videointelligence.enums.Feature.SHOT_CHANGE_DETECTION] operation = video_client.annotate_video(path, features=features) - # [END construct_request] + # [END video_shot_tutorial_construct_request] print('\nProcessing video for shot change annotations:') - # [START check_operation] + # [START video_shot_tutorial_check_operation] result = operation.result(timeout=90) print('\nFinished processing.') - # [END check_operation] + # [END video_shot_tutorial_check_operation] - # [START parse_response] + # [START video_shot_tutorial_parse_response] for i, shot in enumerate(result.annotation_results[0].shot_annotations): start_time = (shot.start_time_offset.seconds + shot.start_time_offset.nanos / 1e9) end_time = (shot.end_time_offset.seconds + shot.end_time_offset.nanos / 1e9) print('\tShot {}: {} to {}'.format(i, start_time, end_time)) - # [END parse_response] + # [END video_shot_tutorial_parse_response] if __name__ == '__main__': - # [START running_app] + # [START video_shot_tutorial_run_application] parser = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) @@ -67,5 +67,5 @@ def analyze_shots(path): args = parser.parse_args() analyze_shots(args.path) - # [END running_app] -# [END full_tutorial] + # [END video_shot_tutorial_run_application] +# [END video_shot_tutorial] From cf2aee6469fd978179038c76f4aa20451a229cea Mon Sep 17 00:00:00 2001 From: Alix Hamilton Date: Thu, 16 Aug 2018 12:42:22 -0700 Subject: [PATCH 5/5] updates to beta region tag --- video/cloud-client/analyze/beta_snippets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/video/cloud-client/analyze/beta_snippets.py b/video/cloud-client/analyze/beta_snippets.py index 78ee469e077..1e9ab2d7329 100644 --- a/video/cloud-client/analyze/beta_snippets.py +++ b/video/cloud-client/analyze/beta_snippets.py @@ -27,7 +27,7 @@ from google.cloud import videointelligence_v1p1beta1 as videointelligence -# [START video_speech_transcription] +# [START video_speech_transcription_gcs_beta] def speech_transcription(input_uri): """Transcribe speech from a video stored on GCS.""" video_client = videointelligence.VideoIntelligenceServiceClient() @@ -66,7 +66,7 @@ def speech_transcription(input_uri): start_time.seconds + start_time.nanos * 1e-9, end_time.seconds + end_time.nanos * 1e-9, word)) -# [END video_speech_transcription] +# [END video_speech_transcription_gcs_beta] if __name__ == '__main__':