-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserving.h
33 lines (26 loc) · 909 Bytes
/
serving.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef ONNXRUNTIME_SERVING_H_
#define ONNXRUNTIME_SERVING_H_
#include <grpcpp/grpcpp.h>
#include <onnxruntime_cxx_api.h>
#include "inference/inference.grpc.pb.h"
namespace serving {
class Serving final : public inference::Runtime::Service {
private:
std::string model_path_; // Private class member for model_path
static const OrtApi* g_ort;
static OrtEnv* g_env;
static OrtSession* g_session;
static OrtAllocator* g_allocator;
size_t num_input_nodes;
std::vector<const char*> input_node_names;
size_t num_output_nodes;
std::vector<const char*> output_node_names;
static void global_init(const std::string& model_path);
public:
explicit Serving(const std::string& model_path);
grpc::Status Run(grpc::ServerContext* context,
const inference::SessionRequest* request,
inference::SessionResponse* reply);
};
} // namespace serving
#endif