Skip to content
This repository was archived by the owner on Jul 7, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions tensor2tensor/serving/serving_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import functools
from googleapiclient import discovery
import grpc
import numpy as np

from tensor2tensor import problems as problems_lib # pylint: disable=unused-import
from tensor2tensor.data_generators import text_encoder
Expand Down Expand Up @@ -140,8 +141,12 @@ def _make_cloud_mlengine_request(examples):
}
} for ex in examples]
}
prediction = api.projects().predict(body=input_data, name=parent).execute()
return prediction["predictions"]
response = api.projects().predict(body=input_data, name=parent).execute()
predictions = response["predictions"]
for prediction in predictions:
prediction["outputs"] = np.array([prediction["outputs"]])
prediction["scores"] = np.array(prediction["scores"])
return predictions

return _make_cloud_mlengine_request

Expand Down