项目作者: jfmlima

项目描述 :
Tensorflow Serving Client in Node.js + Typescript
高级语言: TypeScript
项目地址: git://github.com/jfmlima/tensorflow-serving-node-typescript-client.git
创建时间: 2017-07-11T22:14:07Z
项目社区:https://github.com/jfmlima/tensorflow-serving-node-typescript-client

开源协议:MIT License

下载


Tensorflow Serving Client

Targeting Node.js (v6) and TypeScript

Provides:

  • Prediction of images;
  • And that’s it so far.

Usage Example

  1. import TensorflowServingClient = require( "tensorflow-serving-node-typescript-client");
  2. import fs = require('fs');
  3. class TensorflowServing {
  4. private client: any;
  5. private imagePath: string = "path/to/image.jpg";
  6. public constructor() {
  7. this.client = new TensorflowServingClient.TensorflowServingClient("localhost:9000");
  8. }
  9. public predict(): void {
  10. try {
  11. let buffer = fs.readFileSync(this.imagePath);
  12. this.client.Predict(buffer)
  13. .then((result) => {
  14. console.log(result);
  15. })
  16. .catch((error) => {
  17. console.log(error);
  18. })
  19. }
  20. catch (e) {
  21. console.log(e);
  22. }
  23. }
  24. }
  25. export = TensorflowServing;
Notes
  • This is a work in progress, feel free to improve it.