运行推理#

  1. 对 gRPC 端点执行健康检查。

    • 这里安装 grpcurl

      在 Ubuntu 上运行的示例命令

      $ wget https://github.com/fullstorydev/grpcurl/releases/download/v1.9.1/grpcurl_1.9.1_linux_amd64.deb
      $ sudo dpkg -i grpcurl_1.9.1_linux_amd64.deb
      
    • 下载健康检查 proto

      $ wget https://raw.githubusercontent.com/grpc/grpc/master/src/proto/grpc/health/v1/health.proto
      
    • 运行健康检查

      $ grpcurl --plaintext --proto health.proto localhost:8004 grpc.health.v1.Health/Check
      
    • 如果服务已准备就绪,您将收到类似于以下内容的响应

      { "status": "SERVING" }
      
  2. 通过克隆 gRPC 客户端存储库 下载 Maxine 眼神交流 Python 客户端代码

    git clone https://github.com/NVIDIA-Maxine/nim-clients.git
    
    // Go to the 'eye-contact' folder
    
    cd nim-clients/eye-contact/
    
  3. 安装所需的依赖项

    sudo apt-get install python3-pip
    pip install -r requirements.txt
    

通过脚本运行推理#

您可以使用 Maxine 眼神交流 GitHub 仓库中的示例客户端脚本向托管的 NIM 服务器发送 gRPC 请求

转到 scripts 目录

cd scripts

运行命令以发送 gRPC 请求

python eye-contact.py --target <server_ip:port> --input <input file path> --output <output file path along with file name>

要查看命令行参数的详细信息,请运行此命令

python eye-contact.py -h

您将收到类似于以下内容的响应。

usage: eye-contact.py [-h] [--target TARGET] [--input INPUT] [--output OUTPUT]

Process mp4 video files using gRPC and apply Gaze-redirection.

options:
  -h, --help       show this help message and exit
  --target TARGET  The target gRPC server address.
  --input INPUT    The path to the input video file.
  --output OUTPUT  The path for the output video file.

如果未传递命令行参数,脚本将采用以下默认值

  • target127.0.0.1:8004

  • input../assets/sample_input.mp4

  • output 将是当前目录,名称为 output.mp4