lexicalspace's picture
Update app.py
36a8571 verified
import requests
import gradio as gr
SPACES = {
"Space One": "https://test.hf.space",
"Space Two": "https://hub.hf.space",
"Space Three": "https://Blogger-Toolkit.hf.space",
"Space Four": "https://blogger-source-downloader",
"Space Five": "https://Heavy-Tools",
"Space Six": "https://test.hf.space",
"Space Seven": "https://test.hf.space",
}
def fetch():
rows = []
for name, url in SPACES.items():
try:
r = requests.get(url, timeout=3)
j = r.json()
rows.append([
name,
"🟒 RUNNING",
int(j.get("cpu", 0)),
int(j.get("ram", 0))
])
except:
rows.append([
name,
"⚫ SLEEPING",
0,
0
])
return rows
with gr.Blocks() as demo:
gr.Markdown("## πŸš€ Hugging Face Spaces Monitor")
table = gr.Dataframe(
headers=["Space", "Status", "CPU %", "RAM %"],
datatype=["str", "str", "number", "number"],
interactive=False
)
timer = gr.Timer(value=30)
timer.tick(fetch, outputs=table)
demo.launch()