Spaces:
Sleeping
Sleeping
Update ✨Entity Linking Application✨.py
Browse files
✨Entity Linking Application✨.py
CHANGED
@@ -17,35 +17,6 @@ import time
|
|
17 |
from bs4 import BeautifulSoup
|
18 |
from fake_useragent import UserAgent
|
19 |
import requests
|
20 |
-
import psutil
|
21 |
-
|
22 |
-
def get_system_resources():
|
23 |
-
# Get CPU and memory usage
|
24 |
-
cpu_usage = psutil.cpu_percent(interval=1) # CPU usage in percentage
|
25 |
-
memory = psutil.virtual_memory() # Memory usage
|
26 |
-
memory_usage = memory.percent # Memory usage percentage
|
27 |
-
return cpu_usage, memory_usage
|
28 |
-
|
29 |
-
# Streamlit app layout
|
30 |
-
st.title("System Resource Usage Monitor")
|
31 |
-
|
32 |
-
# Display CPU and memory usage in real-time
|
33 |
-
cpu_bar = st.progress(0)
|
34 |
-
memory_bar = st.progress(0)
|
35 |
-
|
36 |
-
while True:
|
37 |
-
cpu_usage, memory_usage = get_system_resources()
|
38 |
-
|
39 |
-
# Update the progress bars with current usage
|
40 |
-
cpu_bar.progress(cpu_usage)
|
41 |
-
memory_bar.progress(memory_usage)
|
42 |
-
|
43 |
-
# Display usage as text
|
44 |
-
st.write(f"CPU Usage: {cpu_usage}%")
|
45 |
-
st.write(f"Memory Usage: {memory_usage}%")
|
46 |
-
|
47 |
-
# Sleep for a while to avoid overloading the CPU
|
48 |
-
time.sleep(1)
|
49 |
|
50 |
ua = UserAgent()
|
51 |
|
|
|
17 |
from bs4 import BeautifulSoup
|
18 |
from fake_useragent import UserAgent
|
19 |
import requests
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
ua = UserAgent()
|
22 |
|