The problem:
$ nvidia-smi -q | grep -A 5 Utilization
Utilization
GPU : 0 %
Memory : 0 %
Encoder : 0 %
Decoder : 0 %
JPEG : 0 %
The script is looking for the string "Gpu" but Nvidfia-smi outputs "GPU". This can be fixed by making all string comparisons case-insensitive