cahya commited on
Commit
a1448da
1 Parent(s): 1b6ec9d

fixed gpu utilization

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -110,10 +110,12 @@ def process(language: str, model: str, audio_microphone: str, audio_file: str):
110
  time_diff = time_end - time_start
111
  memory = psutil.virtual_memory()
112
  gpu_utilization, gpu_memory = GPUInfo.gpu_usage()
 
 
113
  system_info = f"""
114
  *Memory: {memory.total / (1024 * 1024 * 1024):.2f}GB, used: {memory.percent}%, available: {memory.available / (1024 * 1024 * 1024):.2f}GB.*
115
  *Processing time: {time_diff:.5} seconds.*
116
- *GPU Utilization: {gpu_utilization[0]}%, GPU Memory: {gpu_memory[0]}MiB.*
117
  """
118
  print(f"### {datetime.now()} fp.name:", fp.name)
119
  return transcription, translation, fp.name, system_info
 
110
  time_diff = time_end - time_start
111
  memory = psutil.virtual_memory()
112
  gpu_utilization, gpu_memory = GPUInfo.gpu_usage()
113
+ gpu_utilization = gpu_utilization[0] if len(gpu_utilization) > 0 else 0
114
+ gpu_memory = gpu_memory[0] if len(gpu_memory) > 0 else 0
115
  system_info = f"""
116
  *Memory: {memory.total / (1024 * 1024 * 1024):.2f}GB, used: {memory.percent}%, available: {memory.available / (1024 * 1024 * 1024):.2f}GB.*
117
  *Processing time: {time_diff:.5} seconds.*
118
+ *GPU Utilization: {gpu_utilization}%, GPU Memory: {gpu_memory}MiB.*
119
  """
120
  print(f"### {datetime.now()} fp.name:", fp.name)
121
  return transcription, translation, fp.name, system_info