1// Code generated by protoc-gen-go. DO NOT EDIT. 2// source: google/cloud/ml/v1/prediction_service.proto 3 4package ml 5 6import ( 7 context "context" 8 fmt "fmt" 9 math "math" 10 11 proto "github.com/golang/protobuf/proto" 12 _ "google.golang.org/genproto/googleapis/api/annotations" 13 httpbody "google.golang.org/genproto/googleapis/api/httpbody" 14 grpc "google.golang.org/grpc" 15 codes "google.golang.org/grpc/codes" 16 status "google.golang.org/grpc/status" 17) 18 19// Reference imports to suppress errors if they are not otherwise used. 20var _ = proto.Marshal 21var _ = fmt.Errorf 22var _ = math.Inf 23 24// This is a compile-time assertion to ensure that this generated file 25// is compatible with the proto package it is being compiled against. 26// A compilation error at this line likely means your copy of the 27// proto package needs to be updated. 28const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package 29 30// Request for predictions to be issued against a trained model. 31// 32// The body of the request is a single JSON object with a single top-level 33// field: 34// 35// <dl> 36// <dt>instances</dt> 37// <dd>A JSON array containing values representing the instances to use for 38// prediction.</dd> 39// </dl> 40// 41// The structure of each element of the instances list is determined by your 42// model's input definition. Instances can include named inputs or can contain 43// only unlabeled values. 44// 45// Not all data includes named inputs. Some instances will be simple 46// JSON values (boolean, number, or string). However, instances are often lists 47// of simple values, or complex nested lists. Here are some examples of request 48// bodies: 49// 50// CSV data with each row encoded as a string value: 51// <pre> 52// {"instances": ["1.0,true,\\"x\\"", "-2.0,false,\\"y\\""]} 53// </pre> 54// Plain text: 55// <pre> 56// {"instances": ["the quick brown fox", "la bruja le dio"]} 57// </pre> 58// Sentences encoded as lists of words (vectors of strings): 59// <pre> 60// { 61// "instances": [ 62// ["the","quick","brown"], 63// ["la","bruja","le"], 64// ... 65// ] 66// } 67// </pre> 68// Floating point scalar values: 69// <pre> 70// {"instances": [0.0, 1.1, 2.2]} 71// </pre> 72// Vectors of integers: 73// <pre> 74// { 75// "instances": [ 76// [0, 1, 2], 77// [3, 4, 5], 78// ... 79// ] 80// } 81// </pre> 82// Tensors (in this case, two-dimensional tensors): 83// <pre> 84// { 85// "instances": [ 86// [ 87// [0, 1, 2], 88// [3, 4, 5] 89// ], 90// ... 91// ] 92// } 93// </pre> 94// Images can be represented different ways. In this encoding scheme the first 95// two dimensions represent the rows and columns of the image, and the third 96// contains lists (vectors) of the R, G, and B values for each pixel. 97// <pre> 98// { 99// "instances": [ 100// [ 101// [ 102// [138, 30, 66], 103// [130, 20, 56], 104// ... 105// ], 106// [ 107// [126, 38, 61], 108// [122, 24, 57], 109// ... 110// ], 111// ... 112// ], 113// ... 114// ] 115// } 116// </pre> 117// JSON strings must be encoded as UTF-8. To send binary data, you must 118// base64-encode the data and mark it as binary. To mark a JSON string 119// as binary, replace it with a JSON object with a single attribute named `b64`: 120// <pre>{"b64": "..."} </pre> 121// For example: 122// 123// Two Serialized tf.Examples (fake data, for illustrative purposes only): 124// <pre> 125// {"instances": [{"b64": "X5ad6u"}, {"b64": "IA9j4nx"}]} 126// </pre> 127// Two JPEG image byte strings (fake data, for illustrative purposes only): 128// <pre> 129// {"instances": [{"b64": "ASa8asdf"}, {"b64": "JLK7ljk3"}]} 130// </pre> 131// If your data includes named references, format each instance as a JSON object 132// with the named references as the keys: 133// 134// JSON input data to be preprocessed: 135// <pre> 136// { 137// "instances": [ 138// { 139// "a": 1.0, 140// "b": true, 141// "c": "x" 142// }, 143// { 144// "a": -2.0, 145// "b": false, 146// "c": "y" 147// } 148// ] 149// } 150// </pre> 151// Some models have an underlying TensorFlow graph that accepts multiple input 152// tensors. In this case, you should use the names of JSON name/value pairs to 153// identify the input tensors, as shown in the following exmaples: 154// 155// For a graph with input tensor aliases "tag" (string) and "image" 156// (base64-encoded string): 157// <pre> 158// { 159// "instances": [ 160// { 161// "tag": "beach", 162// "image": {"b64": "ASa8asdf"} 163// }, 164// { 165// "tag": "car", 166// "image": {"b64": "JLK7ljk3"} 167// } 168// ] 169// } 170// </pre> 171// For a graph with input tensor aliases "tag" (string) and "image" 172// (3-dimensional array of 8-bit ints): 173// <pre> 174// { 175// "instances": [ 176// { 177// "tag": "beach", 178// "image": [ 179// [ 180// [138, 30, 66], 181// [130, 20, 56], 182// ... 183// ], 184// [ 185// [126, 38, 61], 186// [122, 24, 57], 187// ... 188// ], 189// ... 190// ] 191// }, 192// { 193// "tag": "car", 194// "image": [ 195// [ 196// [255, 0, 102], 197// [255, 0, 97], 198// ... 199// ], 200// [ 201// [254, 1, 101], 202// [254, 2, 93], 203// ... 204// ], 205// ... 206// ] 207// }, 208// ... 209// ] 210// } 211// </pre> 212// If the call is successful, the response body will contain one prediction 213// entry per instance in the request body. If prediction fails for any 214// instance, the response body will contain no predictions and will contian 215// a single error entry instead. 216type PredictRequest struct { 217 // Required. The resource name of a model or a version. 218 // 219 // Authorization: requires `Viewer` role on the parent project. 220 Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` 221 // 222 // Required. The prediction request body. 223 HttpBody *httpbody.HttpBody `protobuf:"bytes,2,opt,name=http_body,json=httpBody,proto3" json:"http_body,omitempty"` 224 XXX_NoUnkeyedLiteral struct{} `json:"-"` 225 XXX_unrecognized []byte `json:"-"` 226 XXX_sizecache int32 `json:"-"` 227} 228 229func (m *PredictRequest) Reset() { *m = PredictRequest{} } 230func (m *PredictRequest) String() string { return proto.CompactTextString(m) } 231func (*PredictRequest) ProtoMessage() {} 232func (*PredictRequest) Descriptor() ([]byte, []int) { 233 return fileDescriptor_ca7339bffd66a462, []int{0} 234} 235 236func (m *PredictRequest) XXX_Unmarshal(b []byte) error { 237 return xxx_messageInfo_PredictRequest.Unmarshal(m, b) 238} 239func (m *PredictRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 240 return xxx_messageInfo_PredictRequest.Marshal(b, m, deterministic) 241} 242func (m *PredictRequest) XXX_Merge(src proto.Message) { 243 xxx_messageInfo_PredictRequest.Merge(m, src) 244} 245func (m *PredictRequest) XXX_Size() int { 246 return xxx_messageInfo_PredictRequest.Size(m) 247} 248func (m *PredictRequest) XXX_DiscardUnknown() { 249 xxx_messageInfo_PredictRequest.DiscardUnknown(m) 250} 251 252var xxx_messageInfo_PredictRequest proto.InternalMessageInfo 253 254func (m *PredictRequest) GetName() string { 255 if m != nil { 256 return m.Name 257 } 258 return "" 259} 260 261func (m *PredictRequest) GetHttpBody() *httpbody.HttpBody { 262 if m != nil { 263 return m.HttpBody 264 } 265 return nil 266} 267 268func init() { 269 proto.RegisterType((*PredictRequest)(nil), "google.cloud.ml.v1.PredictRequest") 270} 271 272func init() { 273 proto.RegisterFile("google/cloud/ml/v1/prediction_service.proto", fileDescriptor_ca7339bffd66a462) 274} 275 276var fileDescriptor_ca7339bffd66a462 = []byte{ 277 // 308 bytes of a gzipped FileDescriptorProto 278 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x51, 0x4f, 0x4b, 0xfb, 0x30, 279 0x18, 0xa6, 0xe3, 0xc7, 0x4f, 0x17, 0xc1, 0x43, 0x10, 0x9d, 0x45, 0x64, 0xd4, 0xcb, 0x9c, 0x90, 280 0xd0, 0xe9, 0x69, 0xe2, 0x65, 0x27, 0x6f, 0x96, 0x79, 0x10, 0xbc, 0x8c, 0xac, 0x0d, 0x59, 0x24, 281 0xcd, 0x1b, 0xdb, 0xac, 0x30, 0xc4, 0x8b, 0x37, 0xcf, 0x7e, 0x34, 0xbf, 0x82, 0x1f, 0x44, 0xd2, 282 0x04, 0x99, 0xd4, 0xdb, 0x4b, 0xde, 0xe7, 0x79, 0x9f, 0x3f, 0x41, 0x17, 0x02, 0x40, 0x28, 0x4e, 283 0x73, 0x05, 0xeb, 0x82, 0x96, 0x8a, 0x36, 0x29, 0x35, 0x15, 0x2f, 0x64, 0x6e, 0x25, 0xe8, 0x45, 284 0xcd, 0xab, 0x46, 0xe6, 0x9c, 0x98, 0x0a, 0x2c, 0x60, 0xec, 0xc1, 0xa4, 0x05, 0x93, 0x52, 0x91, 285 0x26, 0x8d, 0x4f, 0xc2, 0x01, 0x66, 0x24, 0x65, 0x5a, 0x83, 0x65, 0x8e, 0x58, 0x7b, 0x46, 0x7c, 286 0xbc, 0xb5, 0x5d, 0x59, 0x6b, 0x96, 0x50, 0x6c, 0xfc, 0x2a, 0x79, 0x40, 0xfb, 0x99, 0x17, 0x9a, 287 0xf3, 0xe7, 0x35, 0xaf, 0x2d, 0xc6, 0xe8, 0x9f, 0x66, 0x25, 0x1f, 0x44, 0xc3, 0x68, 0xd4, 0x9f, 288 0xb7, 0x33, 0x4e, 0x51, 0xdf, 0xf1, 0x16, 0x8e, 0x38, 0xe8, 0x0d, 0xa3, 0xd1, 0xde, 0xe4, 0x80, 289 0x04, 0x1b, 0xcc, 0x48, 0x72, 0x6b, 0xad, 0x99, 0x41, 0xb1, 0x99, 0xef, 0xae, 0xc2, 0x34, 0x79, 290 0x8f, 0xd0, 0xd1, 0x9d, 0x56, 0x52, 0xf3, 0xec, 0x27, 0xc8, 0xbd, 0xcf, 0x81, 0x35, 0xda, 0x09, 291 0x8f, 0x38, 0x21, 0xdd, 0x34, 0xe4, 0xb7, 0xa3, 0xf8, 0x4f, 0xa9, 0xe4, 0xfc, 0xed, 0xf3, 0xeb, 292 0xa3, 0x77, 0x96, 0x9c, 0xba, 0xb2, 0x5e, 0x9c, 0xcd, 0x1b, 0x53, 0xc1, 0x13, 0xcf, 0x6d, 0x4d, 293 0xc7, 0xe3, 0xd7, 0x69, 0xe8, 0x6f, 0x1a, 0x8d, 0x67, 0x0a, 0xc5, 0x39, 0x94, 0x1d, 0x25, 0x77, 294 0xae, 0x49, 0x67, 0x87, 0x1d, 0x83, 0x99, 0xab, 0x26, 0x8b, 0x1e, 0xaf, 0x02, 0x43, 0x80, 0x62, 295 0x5a, 0x10, 0xa8, 0x04, 0x15, 0x5c, 0xb7, 0xc5, 0x51, 0xbf, 0x62, 0x46, 0xd6, 0xdb, 0xbf, 0x76, 296 0x5d, 0xaa, 0xe5, 0xff, 0x16, 0x70, 0xf9, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x81, 0x8e, 0x25, 0xca, 297 0xd5, 0x01, 0x00, 0x00, 298} 299 300// Reference imports to suppress errors if they are not otherwise used. 301var _ context.Context 302var _ grpc.ClientConn 303 304// This is a compile-time assertion to ensure that this generated file 305// is compatible with the grpc package it is being compiled against. 306const _ = grpc.SupportPackageIsVersion4 307 308// OnlinePredictionServiceClient is the client API for OnlinePredictionService service. 309// 310// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. 311type OnlinePredictionServiceClient interface { 312 // Performs prediction on the data in the request. 313 // 314 // **** REMOVE FROM GENERATED DOCUMENTATION 315 Predict(ctx context.Context, in *PredictRequest, opts ...grpc.CallOption) (*httpbody.HttpBody, error) 316} 317 318type onlinePredictionServiceClient struct { 319 cc *grpc.ClientConn 320} 321 322func NewOnlinePredictionServiceClient(cc *grpc.ClientConn) OnlinePredictionServiceClient { 323 return &onlinePredictionServiceClient{cc} 324} 325 326func (c *onlinePredictionServiceClient) Predict(ctx context.Context, in *PredictRequest, opts ...grpc.CallOption) (*httpbody.HttpBody, error) { 327 out := new(httpbody.HttpBody) 328 err := c.cc.Invoke(ctx, "/google.cloud.ml.v1.OnlinePredictionService/Predict", in, out, opts...) 329 if err != nil { 330 return nil, err 331 } 332 return out, nil 333} 334 335// OnlinePredictionServiceServer is the server API for OnlinePredictionService service. 336type OnlinePredictionServiceServer interface { 337 // Performs prediction on the data in the request. 338 // 339 // **** REMOVE FROM GENERATED DOCUMENTATION 340 Predict(context.Context, *PredictRequest) (*httpbody.HttpBody, error) 341} 342 343// UnimplementedOnlinePredictionServiceServer can be embedded to have forward compatible implementations. 344type UnimplementedOnlinePredictionServiceServer struct { 345} 346 347func (*UnimplementedOnlinePredictionServiceServer) Predict(ctx context.Context, req *PredictRequest) (*httpbody.HttpBody, error) { 348 return nil, status.Errorf(codes.Unimplemented, "method Predict not implemented") 349} 350 351func RegisterOnlinePredictionServiceServer(s *grpc.Server, srv OnlinePredictionServiceServer) { 352 s.RegisterService(&_OnlinePredictionService_serviceDesc, srv) 353} 354 355func _OnlinePredictionService_Predict_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 356 in := new(PredictRequest) 357 if err := dec(in); err != nil { 358 return nil, err 359 } 360 if interceptor == nil { 361 return srv.(OnlinePredictionServiceServer).Predict(ctx, in) 362 } 363 info := &grpc.UnaryServerInfo{ 364 Server: srv, 365 FullMethod: "/google.cloud.ml.v1.OnlinePredictionService/Predict", 366 } 367 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 368 return srv.(OnlinePredictionServiceServer).Predict(ctx, req.(*PredictRequest)) 369 } 370 return interceptor(ctx, in, info, handler) 371} 372 373var _OnlinePredictionService_serviceDesc = grpc.ServiceDesc{ 374 ServiceName: "google.cloud.ml.v1.OnlinePredictionService", 375 HandlerType: (*OnlinePredictionServiceServer)(nil), 376 Methods: []grpc.MethodDesc{ 377 { 378 MethodName: "Predict", 379 Handler: _OnlinePredictionService_Predict_Handler, 380 }, 381 }, 382 Streams: []grpc.StreamDesc{}, 383 Metadata: "google/cloud/ml/v1/prediction_service.proto", 384} 385