Skip to content

Commit 4c58618

Browse files
committed
Address review feedback
1 parent 1d7a1a3 commit 4c58618

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

video/cloud-client/analyze/analyze.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
import argparse
3131
import base64
32+
import io
3233
import sys
3334
import time
3435

@@ -48,7 +49,7 @@ def analyze_safe_search(path):
4849
while not operation.done():
4950
sys.stdout.write('.')
5051
sys.stdout.flush()
51-
time.sleep(1)
52+
time.sleep(15)
5253

5354
print('\nFinished processing.')
5455

@@ -79,7 +80,7 @@ def analyze_faces(path):
7980
while not operation.done():
8081
sys.stdout.write('.')
8182
sys.stdout.flush()
82-
time.sleep(1)
83+
time.sleep(15)
8384

8485
print('\nFinished processing.')
8586

@@ -114,7 +115,7 @@ def analyze_labels(path):
114115
while not operation.done():
115116
sys.stdout.write('.')
116117
sys.stdout.flush()
117-
time.sleep(1)
118+
time.sleep(15)
118119

119120
print('\nFinished processing.')
120121

@@ -143,17 +144,17 @@ def analyze_labels_file(path):
143144
VideoIntelligenceServiceClient())
144145
features = [enums.Feature.LABEL_DETECTION]
145146

146-
with open(path, "rb") as movie:
147+
with io.open(path, "rb") as movie:
147148
content_base64 = base64.b64encode(movie.read())
148149

149-
operation = video_client.annotate_video('', features,
150-
input_content=content_base64)
150+
operation = video_client.annotate_video(
151+
'', features, input_content=content_base64)
151152
print('\nProcessing video for label annotations:')
152153

153154
while not operation.done():
154155
sys.stdout.write('.')
155156
sys.stdout.flush()
156-
time.sleep(1)
157+
time.sleep(15)
157158

158159
print('\nFinished processing.')
159160

@@ -187,7 +188,7 @@ def analyze_shots(path):
187188
while not operation.done():
188189
sys.stdout.write('.')
189190
sys.stdout.flush()
190-
time.sleep(1)
191+
time.sleep(15)
191192

192193
print('\nFinished processing.')
193194

video/cloud-client/analyze/analyze_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
import os
1818

1919
import analyze
20+
2021
import pytest
2122

23+
2224
BUCKET = os.environ['CLOUD_STORAGE_BUCKET']
2325
LABELS_FILE_PATH = '/video/cat.mp4'
2426
FACES_FILE_PATH = '/video/googlework.mp4'

0 commit comments

Comments
 (0)