Skip to content

Commit

Permalink
fix python2 print unicode issue [(#2183)](#2183)
Browse files Browse the repository at this point in the history
  • Loading branch information
dizcology authored and leahecole committed Sep 15, 2023
1 parent db08d6f commit b44aabe
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions videointelligence/samples/analyze/beta_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ def track_objects_gcs(gcs_uri):

# Get only the first annotation for demo purposes.
object_annotation = object_annotations[0]
print('Entity description: {}'.format(
# description is in Unicode
print(u'Entity description: {}'.format(
object_annotation.entity.description))
if object_annotation.entity.entity_id:
print('Entity id: {}'.format(object_annotation.entity.entity_id))
Expand Down Expand Up @@ -259,7 +260,8 @@ def track_objects(path):

# Get only the first annotation for demo purposes.
object_annotation = object_annotations[0]
print('Entity description: {}'.format(
# description is in Unicode
print(u'Entity description: {}'.format(
object_annotation.entity.description))
if object_annotation.entity.entity_id:
print('Entity id: {}'.format(object_annotation.entity.entity_id))
Expand Down Expand Up @@ -343,7 +345,8 @@ def stream_generator():
description = annotation.entity.description
# Every annotation has only one frame
confidence = annotation.frames[0].confidence
print('\t{} (confidence: {})'.format(description, confidence))
# description is in Unicode
print(u'\t{} (confidence: {})'.format(description, confidence))
# [END video_streaming_label_detection_beta]


Expand Down Expand Up @@ -463,7 +466,8 @@ def stream_generator():
# track_id tracks the same object in the video.
track_id = annotation.track_id

print('\tEntity description: {}'.format(description))
# description is in Unicode
print(u'\tEntity description: {}'.format(description))
print('\tTrack Id: {}'.format(track_id))
if annotation.entity.entity_id:
print('\tEntity id: {}'.format(annotation.entity.entity_id))
Expand Down

0 comments on commit b44aabe

Please sign in to comment.