From 7bd95dcb85ac4be39961db2709764f7bec80be0f Mon Sep 17 00:00:00 2001 From: Olivier Wulveryck Date: Fri, 22 Mar 2019 13:06:53 +0100 Subject: [PATCH] fix: read the model from the actual onnx model --- example/gorgonia/mnist-reader/main.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/example/gorgonia/mnist-reader/main.go b/example/gorgonia/mnist-reader/main.go index 12b4a608..f747f8fb 100644 --- a/example/gorgonia/mnist-reader/main.go +++ b/example/gorgonia/mnist-reader/main.go @@ -5,13 +5,13 @@ import ( "flag" "fmt" "image" + "io/ioutil" "log" "math" "net/http" "github.com/disintegration/imaging" "github.com/owulveryck/onnx-go" - "github.com/owulveryck/onnx-go/internal/examples/mnist" "github.com/vincent-petithory/dataurl" "gorgonia.org/gorgonia/node" gorgonnx "gorgonia.org/gorgonia/onnx" @@ -28,12 +28,18 @@ var ( func main() { port := flag.String("p", "8100", "port to serve on") directory := flag.String("d", ".", "the directory of static file to host") + onnxModel := flag.String("model", "", "the onnx model to use") flag.Parse() graph = gorgonnx.NewGraph() model = onnx.NewModel(graph) - b := mnist.GetMnist() - err := model.Unmarshal(b) + + b, err := ioutil.ReadFile(*onnxModel) + if err != nil { + log.Fatal(err) + } + //b := mnist.GetMnist() + err = model.Unmarshal(b) if err != nil { log.Fatal(err) }