From 93ffd19ede75f995bfbf19bfd3811944ff6499eb Mon Sep 17 00:00:00 2001 From: Dong Daxiang <35550832+guru4elephant@users.noreply.github.com> Date: Sat, 15 Feb 2020 17:10:22 +0800 Subject: [PATCH] Update IMDB_GO_CLIENT.md --- doc/IMDB_GO_CLIENT.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/doc/IMDB_GO_CLIENT.md b/doc/IMDB_GO_CLIENT.md index 90282bb8..896a6e0b 100644 --- a/doc/IMDB_GO_CLIENT.md +++ b/doc/IMDB_GO_CLIENT.md @@ -87,35 +87,35 @@ func main() { for { line, err := br.ReadString('\n') - if err == io.EOF { + if err == io.EOF { break - } + } - line = strings.Trim(line, "\n") + line = strings.Trim(line, "\n") - var words = []int64{} + var words = []int64{} - s := strings.Split(line, " ") - value, err := strconv.Atoi(s[0]) - var feed_int_map map[string][]int64 + s := strings.Split(line, " ") + value, err := strconv.Atoi(s[0]) + var feed_int_map map[string][]int64 - for _, v := range s[1:value + 1] { + for _, v := range s[1:value + 1] { int_v, _ := strconv.Atoi(v) words = append(words, int64(int_v)) - } + } - label, err := strconv.Atoi(s[len(s)-1]) + label, err := strconv.Atoi(s[len(s)-1]) - if err != nil { + if err != nil { panic(err) - } + } - feed_int_map = map[string][]int64{} - feed_int_map["words"] = words - feed_int_map["label"] = []int64{int64(label)} + feed_int_map = map[string][]int64{} + feed_int_map["words"] = words + feed_int_map["label"] = []int64{int64(label)} - result = serving_client.Predict(handle, feed_int_map, fetch) - fmt.Println(result["prediction"][1], "\t", int64(label)) + result = serving_client.Predict(handle, feed_int_map, fetch) + fmt.Println(result["prediction"][1], "\t", int64(label)) } } ``` -- GitLab