slimshadow commited on
Commit
791d68f
·
verified ·
1 Parent(s): eaec60a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -5
app.py CHANGED
@@ -38,15 +38,16 @@ def update_system_info():
38
  disk_used_gb = disk_info.used / (1024 ** 3)
39
  disk_total_gb = disk_info.total / (1024 ** 3)
40
 
41
- system_info_placeholder.write("## Server Information")
42
- system_info_placeholder.write(f"**RAM Usage:** {ram_info.percent}% used ({ram_used_gb:.2f} GB of {ram_total_gb:.2f} GB)")
43
- system_info_placeholder.write(f"**Disk Usage:** {disk_info.percent}% used ({disk_used_gb:.2f} GB of {disk_total_gb:.2f} GB)")
44
 
45
  # Initial system information update
46
  update_system_info()
47
 
48
- # Continuously update system information every 5 seconds
49
- st.experimental_rerun() # Optional: Force a rerun to refresh data
 
50
 
51
  if st.button("Download"):
52
  with st.spinner("Downloading... Please wait."):
@@ -79,3 +80,9 @@ if st.button("Download"):
79
  st.error("Download failed. Please check the URL and try again.")
80
  except Exception as e:
81
  st.error(f"An error occurred: {str(e)}")
 
 
 
 
 
 
 
38
  disk_used_gb = disk_info.used / (1024 ** 3)
39
  disk_total_gb = disk_info.total / (1024 ** 3)
40
 
41
+ system_info_placeholder.markdown("## Server Information")
42
+ system_info_placeholder.markdown(f"**RAM Usage:** {ram_info.percent}% used ({ram_used_gb:.2f} GB of {ram_total_gb:.2f} GB)")
43
+ system_info_placeholder.markdown(f"**Disk Usage:** {disk_info.percent}% used ({disk_used_gb:.2f} GB of {disk_total_gb:.2f} GB)")
44
 
45
  # Initial system information update
46
  update_system_info()
47
 
48
+ # Button to update system information
49
+ if st.button("Update System Information"):
50
+ update_system_info()
51
 
52
  if st.button("Download"):
53
  with st.spinner("Downloading... Please wait."):
 
80
  st.error("Download failed. Please check the URL and try again.")
81
  except Exception as e:
82
  st.error(f"An error occurred: {str(e)}")
83
+
84
+ # Periodically update the system information
85
+ while True:
86
+ update_system_info()
87
+ time.sleep(5)
88
+ st.experimental_rerun()