Skip to content

Commit 09522f6

Browse files
lukesneeringerdanoscarmike
authored andcommitted
Do not base64 encode the input content. [(#1241)](#1241)
Protobuf handles the base64 encoding for you, and so the content was being base64 encoded twice.
1 parent 91f7428 commit 09522f6

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

videointelligence/samples/analyze/analyze.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"""
2929

3030
import argparse
31-
import base64
3231
import io
3332

3433
from google.cloud import videointelligence
@@ -180,15 +179,15 @@ def analyze_labels(path):
180179

181180

182181
def analyze_labels_file(path):
183-
""" Detects labels given a file path. """
182+
"""Detect labels given a file path."""
184183
video_client = videointelligence.VideoIntelligenceServiceClient()
185184
features = [videointelligence.enums.Feature.LABEL_DETECTION]
186185

187-
with io.open(path, "rb") as movie:
188-
content_base64 = base64.b64encode(movie.read())
186+
with io.open(path, 'rb') as movie:
187+
input_content = movie.read()
189188

190189
operation = video_client.annotate_video(
191-
'', features=features, input_content=content_base64)
190+
'', features=features, input_content=input_content)
192191
print('\nProcessing video for label annotations:')
193192

194193
result = operation.result(timeout=90)

0 commit comments

Comments
 (0)