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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
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}%\n")
72
  return gpu_status
73
 
74
  except Exception as e:
@@ -83,24 +83,24 @@ 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\n"
87
  else:
88
  gpu_status = "No GPU available"
89
  return gpu_status
90
 
91
  def update_cpu_status():
92
  import datetime
93
- current_time = datetime.datetime.now().time()
94
- time_str = current_time.strftime("%H:%M:%S")
95
 
96
  cpu_percent = psutil.cpu_percent()
97
- cpu_status = f"> **CPU Usage: {cpu_percent}% {time_str}"
98
  return cpu_status
99
 
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():
 
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}\nUtilization: {gpu_utilization}%\n**Memory Used**: {memory_used}MB\n**Memory Total**: {memory_total}MB\n**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}\n**Free Memory**:{free_memory}MB\n**Total Memory**: {total_memory:.2f} MB\n**Used Memory**: {used_memory:.2f} MB\n"
87
  else:
88
  gpu_status = "No GPU available"
89
  return gpu_status
90
 
91
  def update_cpu_status():
92
  import datetime
93
+ current_time = datetime.datetime.utcnow()
94
+ time_str = current_time.strftime("%Y-%m-%d %H:%M:%S")
95
 
96
  cpu_percent = psutil.cpu_percent()
97
+ cpu_status = f"{time_str}(UTC+0)\n**CPU Usage**: {cpu_percent}%\n"
98
  return cpu_status
99
 
100
  def update_status():
101
  gpu_status = update_gpu_status()
102
  cpu_status = update_cpu_status()
103
+ sys_status=cpu_status+gpu_status
104
  return sys_status
105
 
106
  def refresh_status():