Skip to content

Instantly share code, notes, and snippets.

@sakshamsaxena
Created January 20, 2019 17:46
Show Gist options
  • Save sakshamsaxena/1ffbc689aa198c63c108a62bfa07f3ac to your computer and use it in GitHub Desktop.
Save sakshamsaxena/1ffbc689aa198c63c108a62bfa07f3ac to your computer and use it in GitHub Desktop.
const protoLoader = require('@grpc/proto-loader');
const grpcLibrary = require('grpc');
const options = {
includeDirs: [
'./tensorflow_serving/apis/',
'./tensorflow_serving/config/',
'./tensorflow_serving/core/',
'./tensorflow_serving/util/',
'./tensorflow_serving/sources/',
'./tensorflow/core/example/',
'./tensorflow/core/lib/',
'./tensorflow/core/framework/',
'./tensorflow/core/protobuf/',
'./'
]
}
const packageDefinition = protoLoader.loadSync('prediction_service.proto', options);
console.log(Object.keys(packageDefinition)) // Returned all correctly loaded packages
const packageObject = grpcLibrary.loadPackageDefinition(packageDefinition);
console.log(packageObject)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment