Skip to content

Commit

Permalink
Merge pull request #24 from Yoctol/list_models
Browse files Browse the repository at this point in the history
List models
  • Loading branch information
stegben authored Nov 28, 2018
2 parents c57c757 + c334ccb commit ac3dabe
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
7 changes: 6 additions & 1 deletion serving_utils/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import grpc
import tensorflow as tf

from .protos import predict_pb2, prediction_service_pb2_grpc
from .protos import predict_pb2, prediction_service_pb2_grpc, list_models_pb2, list_models_pb2_grpc


def copy_message(src, dst):
Expand Down Expand Up @@ -123,6 +123,11 @@ def parse_predict_response(response):
results[key] = nd_array
return results

def list_models(self):
stub = list_models_pb2_grpc.ListModelsStub(self._channel)
response = stub.ListModels(list_models_pb2.ListModelsRequest())
return response.models

def predict(
self,
data: List[PredictInput],
Expand Down
12 changes: 12 additions & 0 deletions serving_utils/protos/list_models.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
syntax = "proto3";

service ListModels {
rpc ListModels (ListModelsRequest) returns (ListModelsResponse) {}
}

message ListModelsRequest {
}

message ListModelsResponse {
repeated string models = 1;
}
2 changes: 1 addition & 1 deletion serving_utils/tests/test_saver.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_fit_n_save_serving(self):
],
),
set(
glob(self.model.output_dir + '/*/*') + # noqa:W504
glob(self.model.output_dir + '/*/*') + # noqa: W504
glob(self.model.output_dir + '/*/*/*'),
),
)
Expand Down

0 comments on commit ac3dabe

Please sign in to comment.