Running Inference#

  1. Perform a health check on the gRPC endpoint.

    • Install grpcurl from here

      Example commands to run on 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
      
    • Download the health checking proto:

      $ wget https://raw.githubusercontent.com/grpc/grpc/master/src/proto/grpc/health/v1/health.proto
      
    • Run the health check:

      $ grpcurl --plaintext --proto health.proto localhost:8004 grpc.health.v1.Health/Check
      
    • If the service is ready, you will get a response similar to the following:

      { "status": "SERVING" }
      
  2. Download the Maxine Eye Contact Python client code by cloning the gRPC Client Repository:

    git clone https://github.com/NVIDIA-Maxine/nim-clients.git
    
    // Go to the 'eye-contact' folder
    
    cd nim-clients/eye-contact/
    
  3. Install the required dependencies:

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

Running Inference via Script#

You can use the sample client script in the Maxine Eye Contact GitHub repo to send a gRPC request to the hosted NIM server:

Go to the scripts directory

cd scripts

Run the command to send gRPC request

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

To view details of command line arguments run this command

python eye-contact.py -h

You will get a response similar to the following.

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.

If the command line arguments are not passed, the script will take the following default values:

  • target is 127.0.0.1:8004

  • input is ../assets/sample_input.mp4

  • output will be the current directory with name output.mp4