koenverhagen commited on
Commit
8fa8335
·
1 Parent(s): 01c1ecc

Update server.py

Browse files
Files changed (1) hide show
  1. server.py +8 -8
server.py CHANGED
@@ -89,14 +89,14 @@ async def resolution(request : Request, background_tasks: BackgroundTasks, respo
89
  def check_gpu_usage():
90
  try:
91
  output = subprocess.check_output("nvidia-smi", shell=True).decode("utf-8")
92
- lines = output.split('\n')
93
- for line in lines:
94
- if '%' in line:
95
- usage = line.strip().split(' ')[-2]
96
- print(f"GPU is being used, usage: {usage}")
97
- return
98
- print("GPU is not being used.")
99
- return "GPU is not being used."
100
  except subprocess.CalledProcessError:
101
  print("Nvidia-smi command not found, please check if the NVIDIA drivers are installed.")
102
  return "Nvidia-smi command not found, please check if the NVIDIA drivers are installed."
 
89
  def check_gpu_usage():
90
  try:
91
  output = subprocess.check_output("nvidia-smi", shell=True).decode("utf-8")
92
+ # lines = output.split('\n')
93
+ # usage=[]
94
+ # for line in lines:
95
+ # if '%' in line:
96
+ # usage.append(line.strip().split(' ')[-2])
97
+ #
98
+ # print("GPU is not being used.")
99
+ return output
100
  except subprocess.CalledProcessError:
101
  print("Nvidia-smi command not found, please check if the NVIDIA drivers are installed.")
102
  return "Nvidia-smi command not found, please check if the NVIDIA drivers are installed."