Skip to content

Commit

Permalink
explicitly set timeout in steaming_annotate_video, and comment [(#2182)…
Browse files Browse the repository at this point in the history
…](#2182)
  • Loading branch information
dizcology authored and leahecole committed Sep 15, 2023
1 parent b44aabe commit 6e1d021
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions videointelligence/samples/analyze/beta_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,10 @@ def stream_generator():
requests = stream_generator()

# streaming_annotate_video returns a generator.
responses = client.streaming_annotate_video(requests)
# The default timeout is about 300 seconds.
# To process longer videos it should be set to
# larger than the length (in seconds) of the stream.
responses = client.streaming_annotate_video(requests, timeout=600)

# Each response corresponds to about 1 second of video.
for response in responses:
Expand Down Expand Up @@ -388,7 +391,10 @@ def stream_generator():
requests = stream_generator()

# streaming_annotate_video returns a generator.
responses = client.streaming_annotate_video(requests)
# The default timeout is about 300 seconds.
# To process longer videos it should be set to
# larger than the length (in seconds) of the stream.
responses = client.streaming_annotate_video(requests, timeout=600)

# Each response corresponds to about 1 second of video.
for response in responses:
Expand Down Expand Up @@ -445,7 +451,10 @@ def stream_generator():
requests = stream_generator()

# streaming_annotate_video returns a generator.
responses = client.streaming_annotate_video(requests)
# The default timeout is about 300 seconds.
# To process longer videos it should be set to
# larger than the length (in seconds) of the stream.
responses = client.streaming_annotate_video(requests, timeout=600)

# Each response corresponds to about 1 second of video.
for response in responses:
Expand Down Expand Up @@ -523,7 +532,10 @@ def stream_generator():
requests = stream_generator()

# streaming_annotate_video returns a generator.
responses = client.streaming_annotate_video(requests)
# The default timeout is about 300 seconds.
# To process longer videos it should be set to
# larger than the length (in seconds) of the stream.
responses = client.streaming_annotate_video(requests, timeout=600)

# Each response corresponds to about 1 second of video.
for response in responses:
Expand Down Expand Up @@ -589,7 +601,10 @@ def stream_generator():
requests = stream_generator()

# streaming_annotate_video returns a generator.
responses = client.streaming_annotate_video(requests)
# The default timeout is about 300 seconds.
# To process longer videos it should be set to
# larger than the length (in seconds) of the stream.
responses = client.streaming_annotate_video(requests, timeout=600)

for response in responses:
# Check for errors.
Expand Down

0 comments on commit 6e1d021

Please sign in to comment.