我们将使用 fullstorydev/grpcurl 向 gRPC BentoServer 发送类似于 CURL 的请求。

请注意,我们将使用 docker 来运行 grpcurl 命令。

» docker run -i --rm \
               fullstorydev/grpcurl -d @ -plaintext host.docker.internal:3000 \
               bentoml.grpc.v1.BentoService/Call <<EOT
{
   "apiName": "classify",
   "ndarray": {
      "shape": [1, 4],
      "floatValues": [5.9, 3, 5.1, 1.8]
   }
}
EOT
» docker run -i --rm \
               --network=host \
               fullstorydev/grpcurl -d @ -plaintext 0.0.0.0:3000 \
               bentoml.grpc.v1.BentoService/Call <<EOT
{
   "apiName": "classify",
   "ndarray": {
      "shape": [1, 4],
      "floatValues": [5.9, 3, 5.1, 1.8]
   }
}
EOT

我们将使用 fullstorydev/grpcui 从网页浏览器发送请求。

请注意,我们将使用 docker 来运行 grpcui 命令。

» docker run --init --rm \
               -p 8080:8080 fullstorydev/grpcui -plaintext host.docker.internal:3000
» docker run --init --rm \
               -p 8080:8080 \
               --network=host fullstorydev/grpcui -plaintext 0.0.0.0:3000

请在浏览器中访问 http://127.0.0.1:8080,并通过网页 UI 发送测试请求。