TaiYouWeb commited on
Commit
05c653a
1 Parent(s): bf9bc10

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -68,7 +68,7 @@ def update_gpu_status():
68
  memory_used = gpu.memory_used
69
  memory_total = gpu.memory_total
70
  memory_utilization = (memory_used / memory_total) * 100
71
- gpu_status=(f"> **GPU** {gpu_id}: {gpu_name}, Utilization: {gpu_utilization}%, **Memory Used**: {memory_used}MB, **Memory Total**: {memory_total}MB, **Memory Utilization**: {memory_utilization:.2f}%")
72
  return gpu_status
73
 
74
  except Exception as e:
@@ -83,7 +83,7 @@ def torch_update_gpu_status():
83
  free_memory=gpu_memory[0] /(1024 *1024)
84
  used_memory = (gpu_memory[1] - gpu_memory[0]) / (1024 * 1024)
85
 
86
- gpu_status = f"> **GPU**: {gpu_info} **Free Memory**:{free_memory}MB **Total Memory**: {total_memory:.2f} MB **Used Memory**: {used_memory:.2f} MB"
87
  else:
88
  gpu_status = "No GPU available"
89
  return gpu_status
@@ -100,7 +100,7 @@ def update_cpu_status():
100
  def update_status():
101
  gpu_status = update_gpu_status()
102
  cpu_status = update_cpu_status()
103
- sys_status=gpu_status+"\n"+cpu_status
104
  return sys_status
105
 
106
  def refresh_status():
@@ -442,9 +442,10 @@ with demo:
442
  tab_names=["Audio", "Video", "YouTube"]
443
  )
444
  with gr.Group():
445
- sys_status_output = gr.Markdown(label="System Status")
446
  refresh_button = gr.Button("Refresh System Status")
447
  refresh_button.click(refresh_status, None, sys_status_output)
 
448
 
449
  if __name__ == "__main__":
450
  demo.queue().launch(ssr_mode=False)
 
68
  memory_used = gpu.memory_used
69
  memory_total = gpu.memory_total
70
  memory_utilization = (memory_used / memory_total) * 100
71
+ gpu_status=(f"> **GPU** {gpu_id}: {gpu_name}, Utilization: {gpu_utilization}%, **Memory Used**: {memory_used}MB, **Memory Total**: {memory_total}MB, **Memory Utilization**: {memory_utilization:.2f}%\n")
72
  return gpu_status
73
 
74
  except Exception as e:
 
83
  free_memory=gpu_memory[0] /(1024 *1024)
84
  used_memory = (gpu_memory[1] - gpu_memory[0]) / (1024 * 1024)
85
 
86
+ gpu_status = f"> **GPU**: {gpu_info} **Free Memory**:{free_memory}MB **Total Memory**: {total_memory:.2f} MB **Used Memory**: {used_memory:.2f} MB\n"
87
  else:
88
  gpu_status = "No GPU available"
89
  return gpu_status
 
100
  def update_status():
101
  gpu_status = update_gpu_status()
102
  cpu_status = update_cpu_status()
103
+ sys_status=gpu_status+cpu_status
104
  return sys_status
105
 
106
  def refresh_status():
 
442
  tab_names=["Audio", "Video", "YouTube"]
443
  )
444
  with gr.Group():
445
+ sys_status_output = gr.Markdown(label="System Status", container=True, line_breaks=True, show_copy_button=True)
446
  refresh_button = gr.Button("Refresh System Status")
447
  refresh_button.click(refresh_status, None, sys_status_output)
448
+ sys_status_output.value = refresh_status()
449
 
450
  if __name__ == "__main__":
451
  demo.queue().launch(ssr_mode=False)