m8chaa commited on
Commit
fd27857
·
verified ·
1 Parent(s): 063488a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -14
app.py CHANGED
@@ -1,18 +1,22 @@
1
- import psutil
2
  import streamlit as st
3
- import cpuinfo # Import the cpuinfo library
4
 
5
- def get_cpu_info():
6
- info = cpuinfo.get_cpu_info() # Use cpuinfo to get detailed CPU information
7
- cpu_details = {
8
- "Processor": info.get('brand_raw', ''), # Get the CPU brand
9
- "Physical cores": psutil.cpu_count(logical=False),
10
- "Total cores": psutil.cpu_count(logical=True),
11
- "Max Frequency": f"{psutil.cpu_freq().max:.2f} MHz",
12
- "Min Frequency": f"{psutil.cpu_freq().min:.2f} MHz",
13
- "Current Frequency": f"{psutil.cpu_freq().current:.2f} MHz",
14
- }
15
- return cpu_details
 
 
 
 
 
16
 
17
  if __name__ == "__main__":
18
- st.write(get_cpu_info())
 
 
1
  import streamlit as st
2
+ import speedtest
3
 
4
+ def test_internet_speed():
5
+ s = speedtest.Speedtest()
6
+ s.get_best_server()
7
+ download_speed = s.download() / 1024 / 1024 # Convert to Mbps
8
+ upload_speed = s.upload() / 1024 / 1024 # Convert to Mbps
9
+ return download_speed, upload_speed
10
+
11
+ def main():
12
+ st.title('Internet Speed Test')
13
+
14
+ if st.button('Test Internet Speed'):
15
+ with st.spinner('Testing...'):
16
+ download_speed, upload_speed = test_internet_speed()
17
+ st.success('Test completed')
18
+ st.write(f"Download speed: {download_speed:.2f} Mbps")
19
+ st.write(f"Upload speed: {upload_speed:.2f} Mbps")
20
 
21
  if __name__ == "__main__":
22
+ main()