Skip to content

Commit b437488

Browse files
authored
Coerce string to bytes in py2-3 compat way (GoogleCloudPlatform#867)
1 parent 4ebd4c3 commit b437488

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ml_engine/online_prediction/predict.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def census_to_example_bytes(json_instance):
122122
for key, data in six.iteritems(json_instance):
123123
if isinstance(data, six.string_types):
124124
feature_dict[key] = tf.train.Feature(
125-
bytes_list=tf.train.BytesList(value=[str(data)]))
125+
bytes_list=tf.train.BytesList(value=[data.encode('utf-8')]))
126126
elif isinstance(data, float):
127127
feature_dict[key] = tf.train.Feature(
128128
float_list=tf.train.FloatList(value=[data]))

0 commit comments

Comments
 (0)