DmitrMakeev commited on
Commit
eeec488
·
verified ·
1 Parent(s): 778e7da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -1
app.py CHANGED
@@ -10,6 +10,7 @@ from datetime import datetime
10
  import pytz
11
 
12
 
 
13
 
14
 
15
 
@@ -219,6 +220,15 @@ def monitor():
219
  used_gb = used // (2**30)
220
  free_gb = free // (2**30)
221
 
 
 
 
 
 
 
 
 
 
222
  return render_template('monitor.html',
223
  uploaded_files=files,
224
  uploaded_html_files=html_files,
@@ -226,7 +236,13 @@ def monitor():
226
  'total': f"{total_gb} GB",
227
  'used': f"{used_gb} GB",
228
  'free': f"{free_gb} GB"
229
- })
 
 
 
 
 
 
230
 
231
  if __name__ == '__main__':
232
  app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 7860)))
 
10
  import pytz
11
 
12
 
13
+ import psutil
14
 
15
 
16
 
 
220
  used_gb = used // (2**30)
221
  free_gb = free // (2**30)
222
 
223
+ # Получаем информацию об использовании оперативной памяти
224
+ memory = psutil.virtual_memory()
225
+ memory_total_gb = memory.total // (2**30)
226
+ memory_used_gb = memory.used // (2**30)
227
+ memory_free_gb = memory.free // (2**30)
228
+
229
+ # Получаем информацию о количестве процессоров
230
+ cpu_count = psutil.cpu_count(logical=True)
231
+
232
  return render_template('monitor.html',
233
  uploaded_files=files,
234
  uploaded_html_files=html_files,
 
236
  'total': f"{total_gb} GB",
237
  'used': f"{used_gb} GB",
238
  'free': f"{free_gb} GB"
239
+ },
240
+ memory_usage={
241
+ 'total': f"{memory_total_gb} GB",
242
+ 'used': f"{memory_used_gb} GB",
243
+ 'free': f"{memory_free_gb} GB"
244
+ },
245
+ cpu_count=cpu_count)
246
 
247
  if __name__ == '__main__':
248
  app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 7860)))