Thanks for your reply, but I got such an error when I ran your code:
Traceback (most recent call last):
  File "/home/hdl2/Desktop/SonoFetalImage/playground.py", line 21, in <module>
    free_gpu_id = get_free_gpu()
  File "/home/hdl2/Desktop/SonoFetalImage/playground.py", line 12, in get_free_gpu
    gpu_df = pd.read_csv(StringIO(gpu_status),
TypeError: initial_value must be str or None, not bytes

How to solve it?