|
16 | 16 | # source: tensorflow_serving/apis/prediction_service.proto |
17 | 17 |
|
18 | 18 | import sys |
19 | | -_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode('latin1')) |
| 19 | +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) |
20 | 20 | from google.protobuf import descriptor as _descriptor |
21 | 21 | from google.protobuf import message as _message |
22 | 22 | from google.protobuf import reflection as _reflection |
|
26 | 26 |
|
27 | 27 | _sym_db = _symbol_database.Default() |
28 | 28 |
|
29 | | -from tensorflow_serving.apis import predict_pb2 as third__party_dot_tensorflow__serving_dot_apis_dot_predict__pb2 |
| 29 | + |
| 30 | +from tensorflow_serving.apis import predict_pb2 as tensorflow__serving_dot_apis_dot_predict__pb2 |
| 31 | + |
30 | 32 |
|
31 | 33 | DESCRIPTOR = _descriptor.FileDescriptor( |
32 | | - name='tensorflow_serving/apis/prediction_service.proto', |
33 | | - package='tensorflow.serving', |
34 | | - syntax='proto3', |
35 | | - serialized_pb=_b( |
36 | | - '\n<tensorflow_serving/apis/prediction_service.proto\x12\x12tensorflow.serving\x1a\x31tensorflow_serving/apis/predict.proto2g\n\x11PredictionService\x12R\n\x07Predict\x12\".tensorflow.serving.PredictRequest\x1a#.tensorflow.serving.PredictResponseB\x03\xf8\x01\x01\x62\x06proto3'), |
37 | | - dependencies=[ |
38 | | - third__party_dot_tensorflow__serving_dot_apis_dot_predict__pb2. |
39 | | - DESCRIPTOR, |
40 | | - ]) |
| 34 | + name='tensorflow_serving/apis/prediction_service.proto', |
| 35 | + package='tensorflow.serving', |
| 36 | + syntax='proto3', |
| 37 | + serialized_pb=_b('\n0tensorflow_serving/apis/prediction_service.proto\x12\x12tensorflow.serving\x1a%tensorflow_serving/apis/predict.proto2g\n\x11PredictionService\x12R\n\x07Predict\x12\".tensorflow.serving.PredictRequest\x1a#.tensorflow.serving.PredictResponseB\x03\xf8\x01\x01\x62\x06proto3') |
| 38 | + , |
| 39 | + dependencies=[tensorflow__serving_dot_apis_dot_predict__pb2.DESCRIPTOR,]) |
41 | 40 | _sym_db.RegisterFileDescriptor(DESCRIPTOR) |
42 | 41 |
|
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
43 | 46 | DESCRIPTOR.has_options = True |
44 | | -DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), |
45 | | - _b('\370\001\001')) |
46 | | -from grpc.beta import implementations as beta_implementations |
47 | | -from grpc.beta import interfaces as beta_interfaces |
| 47 | +DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\370\001\001')) |
| 48 | + |
| 49 | +import grpc |
48 | 50 | from grpc.framework.common import cardinality |
49 | 51 | from grpc.framework.interfaces.face import utilities as face_utilities |
| 52 | +from grpc.beta import implementations as beta_implementations |
| 53 | +from grpc.beta import interfaces as beta_interfaces |
50 | 54 |
|
51 | 55 |
|
52 | | -class BetaPredictionServiceServicer(object): |
53 | | - """PredictionService provides basic machine learning methods. |
| 56 | +class PredictionServiceStub(object): |
| 57 | + """PredictionService provides access to machine-learned models loaded by |
| 58 | + model_servers. |
| 59 | + """ |
| 60 | + |
| 61 | + def __init__(self, channel): |
| 62 | + """Constructor. |
| 63 | +
|
| 64 | + Args: |
| 65 | + channel: A grpc.Channel. |
| 66 | + """ |
| 67 | + self.Predict = channel.unary_unary( |
| 68 | + '/tensorflow.serving.PredictionService/Predict', |
| 69 | + request_serializer=tensorflow__serving_dot_apis_dot_predict__pb2.PredictRequest.SerializeToString, |
| 70 | + response_deserializer=tensorflow__serving_dot_apis_dot_predict__pb2.PredictResponse.FromString, |
| 71 | + ) |
54 | 72 |
|
55 | | - TODO(b/28599843): Decide whether to keep the separate services in addition to |
56 | | - this combined service. |
| 73 | + |
| 74 | +class PredictionServiceServicer(object): |
| 75 | + """PredictionService provides access to machine-learned models loaded by |
| 76 | + model_servers. |
57 | 77 | """ |
58 | 78 |
|
59 | 79 | def Predict(self, request, context): |
60 | | - """Predict. |
| 80 | + """Predict -- provides access to loaded TensorFlow model. |
| 81 | + """ |
| 82 | + context.set_code(grpc.StatusCode.UNIMPLEMENTED) |
| 83 | + context.set_details('Method not implemented!') |
| 84 | + raise NotImplementedError('Method not implemented!') |
| 85 | + |
| 86 | + |
| 87 | +def add_PredictionServiceServicer_to_server(servicer, server): |
| 88 | + rpc_method_handlers = { |
| 89 | + 'Predict': grpc.unary_unary_rpc_method_handler( |
| 90 | + servicer.Predict, |
| 91 | + request_deserializer=tensorflow__serving_dot_apis_dot_predict__pb2.PredictRequest.FromString, |
| 92 | + response_serializer=tensorflow__serving_dot_apis_dot_predict__pb2.PredictResponse.SerializeToString, |
| 93 | + ), |
| 94 | + } |
| 95 | + generic_handler = grpc.method_handlers_generic_handler( |
| 96 | + 'tensorflow.serving.PredictionService', rpc_method_handlers) |
| 97 | + server.add_generic_rpc_handlers((generic_handler,)) |
| 98 | + |
| 99 | + |
| 100 | +class BetaPredictionServiceServicer(object): |
| 101 | + """The Beta API is deprecated for 0.15.0 and later. |
| 102 | +
|
| 103 | + It is recommended to use the GA API (classes and functions in this |
| 104 | + file not marked beta) for all further purposes. This class was generated |
| 105 | + only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0.""" |
| 106 | + """PredictionService provides access to machine-learned models loaded by |
| 107 | + model_servers. |
| 108 | + """ |
| 109 | + def Predict(self, request, context): |
| 110 | + """Predict -- provides access to loaded TensorFlow model. |
61 | 111 | """ |
62 | 112 | context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) |
63 | 113 |
|
64 | 114 |
|
65 | 115 | class BetaPredictionServiceStub(object): |
66 | | - """PredictionService provides basic machine learning methods. |
| 116 | + """The Beta API is deprecated for 0.15.0 and later. |
67 | 117 |
|
68 | | - TODO(b/28599843): Decide whether to keep the separate services in addition to |
69 | | - this combined service. |
| 118 | + It is recommended to use the GA API (classes and functions in this |
| 119 | + file not marked beta) for all further purposes. This class was generated |
| 120 | + only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0.""" |
| 121 | + """PredictionService provides access to machine-learned models loaded by |
| 122 | + model_servers. |
70 | 123 | """ |
71 | | - |
72 | | - def Predict(self, |
73 | | - request, |
74 | | - timeout, |
75 | | - metadata=None, |
76 | | - with_call=False, |
77 | | - protocol_options=None): |
78 | | - """Predict. |
| 124 | + def Predict(self, request, timeout, metadata=None, with_call=False, protocol_options=None): |
| 125 | + """Predict -- provides access to loaded TensorFlow model. |
79 | 126 | """ |
80 | 127 | raise NotImplementedError() |
81 | | - |
82 | 128 | Predict.future = None |
83 | 129 |
|
84 | 130 |
|
85 | | -def beta_create_PredictionService_server(servicer, |
86 | | - pool=None, |
87 | | - pool_size=None, |
88 | | - default_timeout=None, |
89 | | - maximum_timeout=None): |
| 131 | +def beta_create_PredictionService_server(servicer, pool=None, pool_size=None, default_timeout=None, maximum_timeout=None): |
| 132 | + """The Beta API is deprecated for 0.15.0 and later. |
| 133 | +
|
| 134 | + It is recommended to use the GA API (classes and functions in this |
| 135 | + file not marked beta) for all further purposes. This function was |
| 136 | + generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0""" |
90 | 137 | request_deserializers = { |
91 | | - ('tensorflow.serving.PredictionService', 'Predict'): |
92 | | - third__party_dot_tensorflow__serving_dot_apis_dot_predict__pb2. |
93 | | - PredictRequest.FromString, |
| 138 | + ('tensorflow.serving.PredictionService', 'Predict'): tensorflow__serving_dot_apis_dot_predict__pb2.PredictRequest.FromString, |
94 | 139 | } |
95 | 140 | response_serializers = { |
96 | | - ('tensorflow.serving.PredictionService', 'Predict'): |
97 | | - third__party_dot_tensorflow__serving_dot_apis_dot_predict__pb2. |
98 | | - PredictResponse.SerializeToString, |
| 141 | + ('tensorflow.serving.PredictionService', 'Predict'): tensorflow__serving_dot_apis_dot_predict__pb2.PredictResponse.SerializeToString, |
99 | 142 | } |
100 | 143 | method_implementations = { |
101 | | - ('tensorflow.serving.PredictionService', 'Predict'): |
102 | | - face_utilities.unary_unary_inline(servicer.Predict), |
| 144 | + ('tensorflow.serving.PredictionService', 'Predict'): face_utilities.unary_unary_inline(servicer.Predict), |
103 | 145 | } |
104 | | - server_options = beta_implementations.server_options( |
105 | | - request_deserializers=request_deserializers, |
106 | | - response_serializers=response_serializers, |
107 | | - thread_pool=pool, |
108 | | - thread_pool_size=pool_size, |
109 | | - default_timeout=default_timeout, |
110 | | - maximum_timeout=maximum_timeout) |
111 | | - return beta_implementations.server( |
112 | | - method_implementations, options=server_options) |
113 | | - |
114 | | - |
115 | | -def beta_create_PredictionService_stub(channel, |
116 | | - host=None, |
117 | | - metadata_transformer=None, |
118 | | - pool=None, |
119 | | - pool_size=None): |
| 146 | + server_options = beta_implementations.server_options(request_deserializers=request_deserializers, response_serializers=response_serializers, thread_pool=pool, thread_pool_size=pool_size, default_timeout=default_timeout, maximum_timeout=maximum_timeout) |
| 147 | + return beta_implementations.server(method_implementations, options=server_options) |
| 148 | + |
| 149 | + |
| 150 | +def beta_create_PredictionService_stub(channel, host=None, metadata_transformer=None, pool=None, pool_size=None): |
| 151 | + """The Beta API is deprecated for 0.15.0 and later. |
| 152 | +
|
| 153 | + It is recommended to use the GA API (classes and functions in this |
| 154 | + file not marked beta) for all further purposes. This function was |
| 155 | + generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0""" |
120 | 156 | request_serializers = { |
121 | | - ('tensorflow.serving.PredictionService', 'Predict'): |
122 | | - third__party_dot_tensorflow__serving_dot_apis_dot_predict__pb2. |
123 | | - PredictRequest.SerializeToString, |
| 157 | + ('tensorflow.serving.PredictionService', 'Predict'): tensorflow__serving_dot_apis_dot_predict__pb2.PredictRequest.SerializeToString, |
124 | 158 | } |
125 | 159 | response_deserializers = { |
126 | | - ('tensorflow.serving.PredictionService', 'Predict'): |
127 | | - third__party_dot_tensorflow__serving_dot_apis_dot_predict__pb2. |
128 | | - PredictResponse.FromString, |
| 160 | + ('tensorflow.serving.PredictionService', 'Predict'): tensorflow__serving_dot_apis_dot_predict__pb2.PredictResponse.FromString, |
| 161 | + } |
| 162 | + cardinalities = { |
| 163 | + 'Predict': cardinality.Cardinality.UNARY_UNARY, |
129 | 164 | } |
130 | | - cardinalities = {'Predict': cardinality.Cardinality.UNARY_UNARY,} |
131 | | - stub_options = beta_implementations.stub_options( |
132 | | - host=host, |
133 | | - metadata_transformer=metadata_transformer, |
134 | | - request_serializers=request_serializers, |
135 | | - response_deserializers=response_deserializers, |
136 | | - thread_pool=pool, |
137 | | - thread_pool_size=pool_size) |
138 | | - return beta_implementations.dynamic_stub( |
139 | | - channel, |
140 | | - 'tensorflow.serving.PredictionService', |
141 | | - cardinalities, |
142 | | - options=stub_options) |
143 | | -# @@protoc_insertion_point(module_scope) |
| 165 | + stub_options = beta_implementations.stub_options(host=host, metadata_transformer=metadata_transformer, request_serializers=request_serializers, response_deserializers=response_deserializers, thread_pool=pool, thread_pool_size=pool_size) |
| 166 | + return beta_implementations.dynamic_stub(channel, 'tensorflow.serving.PredictionService', cardinalities, options=stub_options) |
0 commit comments