@@ -22,8 +22,14 @@ import numpy as np
2222
2323my_mlmodel = MLModelClient.from_robot(robot = machine, name = " my_mlmodel_service" )
2424
25- nd_array = np.array([1 , 2 , 3 ], dtype = np.float64)
26- input_tensors = {" 0" : nd_array}
25+ output_tensors = await my_mlmodel.infer(input_tensors)
26+
27+ image_data = np.zeros((1 , 384 , 384 , 3 ), dtype = np.uint8)
28+
29+ # Create the input tensors dictionary
30+ input_tensors = {
31+ " image" : image_data
32+ }
2733
2834output_tensors = await my_mlmodel.infer(input_tensors)
2935```
@@ -46,7 +52,20 @@ For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/
4652** Example:**
4753
4854``` go {class="line-numbers linkable-line-numbers"}
49- input_tensors := ml.Tensors {" 0" : tensor.New (tensor.WithShape (1 , 2 , 3 ), tensor.WithBacking ([]int {1 , 2 , 3 , 4 , 5 , 6 }))}
55+ import (
56+ " go.viam.com/rdk/ml"
57+ " gorgonia.org/tensor"
58+ )
59+
60+ myMLModel , err := mlmodel.FromRobot (machine, " my_mlmodel_service" )
61+
62+ input_tensors := ml.Tensors {
63+ " image" : tensor.New (
64+ tensor.Of (tensor.Uint8 ),
65+ tensor.WithShape (1 , 384 , 384 , 3 ),
66+ tensor.WithBacking (make ([]uint8 , 1 *384 *384 *3 )),
67+ ),
68+ }
5069
5170output_tensors , err := myMLModel.Infer (context.Background (), input_tensors)
5271```
@@ -97,6 +116,7 @@ For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/
97116** Example:**
98117
99118``` go {class="line-numbers linkable-line-numbers"}
119+ myMLModel , err := mlmodel.FromRobot (machine, " my_mlmodel_service" )
100120metadata , err := myMLModel.Metadata (context.Background ())
101121```
102122
0 commit comments