From c9d0c9b3500a3cbbc194067080ed0a6e41e4fb56 Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Tue, 9 Jun 2020 11:40:08 -0700 Subject: [PATCH] fix: changes positional to named pararameters in Video samples (#4017) Changes calls to `VideoClient.annotate_video()` so that GCS URIs are provided as named parameters. Example: ``` operation = video_client.annotate_video(path, features=features) ``` Becomes: ``` operation = video_client.annotate_video(input_uri=path, features=features) ``` --- video/cloud-client/analyze/analyze.py | 8 ++++---- video/cloud-client/labels/labels.py | 2 +- video/cloud-client/shotchange/shotchange.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/video/cloud-client/analyze/analyze.py b/video/cloud-client/analyze/analyze.py index 75bf3248a67a..85a536e1cb5a 100644 --- a/video/cloud-client/analyze/analyze.py +++ b/video/cloud-client/analyze/analyze.py @@ -44,7 +44,7 @@ def analyze_explicit_content(path): video_client = videointelligence.VideoIntelligenceServiceClient() features = [videointelligence.enums.Feature.EXPLICIT_CONTENT_DETECTION] - operation = video_client.annotate_video(path, features=features) + operation = video_client.annotate_video(input_uri=path, features=features) print("\nProcessing video for explicit content annotations:") result = operation.result(timeout=90) @@ -70,7 +70,7 @@ def analyze_labels(path): context = videointelligence.types.VideoContext(label_detection_config=config) operation = video_client.annotate_video( - path, features=features, video_context=context + input_uri=path, features=features, video_context=context ) print("\nProcessing video for label annotations:") @@ -233,7 +233,7 @@ def analyze_shots(path): """ Detects camera shot changes. """ video_client = videointelligence.VideoIntelligenceServiceClient() features = [videointelligence.enums.Feature.SHOT_CHANGE_DETECTION] - operation = video_client.annotate_video(path, features=features) + operation = video_client.annotate_video(input_uri=path, features=features) print("\nProcessing video for shot change annotations:") result = operation.result(timeout=90) @@ -263,7 +263,7 @@ def speech_transcription(path): ) operation = video_client.annotate_video( - path, features=features, video_context=video_context + input_uri=path, features=features, video_context=video_context ) print("\nProcessing video for speech transcription.") diff --git a/video/cloud-client/labels/labels.py b/video/cloud-client/labels/labels.py index 4a1cf7679ec6..cfb4ad0c4259 100644 --- a/video/cloud-client/labels/labels.py +++ b/video/cloud-client/labels/labels.py @@ -40,7 +40,7 @@ def analyze_labels(path): # [START video_label_tutorial_construct_request] video_client = videointelligence.VideoIntelligenceServiceClient() features = [videointelligence.enums.Feature.LABEL_DETECTION] - operation = video_client.annotate_video(path, features=features) + operation = video_client.annotate_video(input_uri=path, features=features) # [END video_label_tutorial_construct_request] print('\nProcessing video for label annotations:') diff --git a/video/cloud-client/shotchange/shotchange.py b/video/cloud-client/shotchange/shotchange.py index 81bdefba6691..40edf0012cec 100644 --- a/video/cloud-client/shotchange/shotchange.py +++ b/video/cloud-client/shotchange/shotchange.py @@ -39,7 +39,7 @@ def analyze_shots(path): # [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) + operation = video_client.annotate_video(input_uri=path, features=features) # [END video_shot_tutorial_construct_request] print('\nProcessing video for shot change annotations:')