{"id":15159439,"url":"https://github.com/datainq/go-mnist-client","last_synced_at":"2025-10-24T16:31:15.911Z","repository":{"id":131066432,"uuid":"117722585","full_name":"datainq/go-mnist-client","owner":"datainq","description":"TensorFlow serving mnist example client in Go.","archived":false,"fork":false,"pushed_at":"2018-01-22T06:35:34.000Z","size":105,"stargazers_count":17,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-31T03:13:29.017Z","etag":null,"topics":["go","golang","grpc","tensorflow","tensorflow-examples","tensorflow-tutorials"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/datainq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-16T18:18:11.000Z","updated_at":"2024-02-27T03:36:40.000Z","dependencies_parsed_at":"2024-06-20T15:30:12.486Z","dependency_job_id":"fe01f29a-9e87-4059-a2b5-0284d1154d8b","html_url":"https://github.com/datainq/go-mnist-client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datainq%2Fgo-mnist-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datainq%2Fgo-mnist-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datainq%2Fgo-mnist-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datainq%2Fgo-mnist-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/datainq","download_url":"https://codeload.github.com/datainq/go-mnist-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237999678,"owners_count":19399920,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","grpc","tensorflow","tensorflow-examples","tensorflow-tutorials"],"created_at":"2024-09-26T21:21:56.725Z","updated_at":"2025-10-24T16:31:10.546Z","avatar_url":"https://github.com/datainq.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-mnist-client\n\nAn example of tensorflow_serving client in Go. \n\nIt demonstrates how to connect to the `tensorflow_model_server` launched\nas described in \n[Serving a TensorFlow Model](https://www.tensorflow.org/serving/serving_basic) on\nTensorFlow documentation webpage.\n\nThe main problem with tensorflow_serving is a lack of Go package ready to \nimport and run.\n\nThis example is based on:\n[github.com/tobegit3hub/tensorflow_template_application](https://github.com/tobegit3hub/tensorflow_template_application)\n\n## Setup fake workspace through a`$GOPATH` or copy files\n\nFor a convenience, I provide the generated files under the `gopath` \nsubdirectory. You can copy files directly to your `$GOPATH`.\n\n```bash\ncp gopath/src $GOPATH\n```\n\n## Generating from sources\n\nFor a purpose of generating proto we will use a `docker` container `grpc/go` with \n`protoc`, `go` and [`gRPC`](https://grpc.io/) protoc extension installed.\n\nRemember that a version of TensorFlow Serving, TensorFlow C++ library and\nand Go TensorFlow library versions should match.\n\n```\ngo get -u golang.org/x/net/context\ngo get -u github.com/golang/protobuf/{proto,protoc-gen-go}\ngo get -u google.golang.org/grpc\ngo get -u github.com/tensorflow/tensorflow/tensorflow/go\ngo get -u go.uber.org/ratelimit\n```\n\n\nLet's start a docker container mounting a fake gopath:\n```bash\ndocker run --rm -it -v $PWD/gopath:/gopath:ro -v $PWD/gen:/gen grpc/go /bin/bash\n```\nand copy paste:\n```\nexport GOPATH=/gopath\n\ngit clone https://github.com/tensorflow/serving\ngit clone https://github.com/tensorflow/tensorflow\n\nIN=$PWD\nOUT=/gen\nprotoc -I=$IN/serving -I $IN/tensorflow \\\n    --go_out=plugins=grpc:$OUT \\\n    $IN/serving/tensorflow_serving/apis/*.proto\n\nIN=$PWD/tensorflow\nprotoc -I=$IN --go_out=plugins=grpc:$OUT \\\n    $IN/tensorflow/core/framework/*.proto\n    \nprotoc -I=$IN --go_out=plugins=grpc:$OUT \\\n    $IN/tensorflow/core/protobuf/{saver,meta_graph}.proto\n    \nprotoc -I=$IN --go_out=plugins=grpc:$OUT \\\n    $IN/tensorflow/core/example/*.proto\n```\n\nIn most cases we have to fix permissions:\n```bash\nsudo chown -R $USER.$USER gen\n```\n\nMost of the tensorflow_serving and tensorflow is not prepared to be\nimported in go directly, therefore we must **fix incorrect import paths**:\n\n``` \ngrep -rl '\"tensorflow/' --include \\*.go gen | \nxargs sed -i 's/\"tensorflow\\//\"github.com\\/tensorflow\\/tensorflow\\/tensorflow\\/go\\//g'\n```\n\nAnd now we need to copy files into the GOPATH:\n```bash\nmkdir -p $GOPATH/src/github.com/tensorflow/serving\ncp -R gen/tensorflow_serving $GOPATH/src/github.com/tensorflow/serving/\nmkdir -p $GOPATH/src/github.com/tensorflow/tensorflow/tensorflow/go/\ncp -R gen/tensorflow/core $GOPATH/src/github.com/tensorflow/tensorflow/tensorflow/go/\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatainq%2Fgo-mnist-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatainq%2Fgo-mnist-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatainq%2Fgo-mnist-client/lists"}