Giter VIP home page Giter VIP logo

tf-bridge's Introduction

Tensor Bridge

Tensor Bridge is an OpenAPI Specification as well as a simple Connexion wrapper for TensorFlow Serving.

The specification was obtained by compiling an annotated tensor_bridge.proto using grpc-gateway. The result is located in swagger/tensor_bridge.json.

How is this useful?

The publicly available version of TensorFlow serving works over gRPC.

Now you can use the API to build your own REST service and use JSON to talk to your TensorFlow models. A full example is included in this repo (see app.py and api/). If you prefer Go, you can even generate a reverse proxy automatically using grpc-gateway.

Installation

Simply run

docker build -t tf-bridge .

from the project root.

This will take a while as you are compiling TensorFlow and TensorFlow Serving from source. (Consider dedicating around 6-8 GB of RAM to Docker)

When the image is created you can start the servers

docker run -d -p 9001:9001 -p 9000:9000 -e MODEL=mnist tf-bridge

Tensor Bridge can be queried at 9001.

The gRPC endpoint is still available at 9000 for convenience and testing.

You will notice that we use the MODEL variable to specify the model. As an example, we included an exported MNIST model in this repo.

To see the Swagger UI go to http://localhost:9001/ui/

Client

There is also a simple client located in client/mnist_client.py for testing purposes. Make sure to install the necessary dependencies from requirements.txt.

If everything went well, you will shortly get the following output

Inference error rate: 10.4%

tf-bridge's People

Contributors

ironvital avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.