Spaces:
Sleeping
Sleeping
Download app.py from srinetwork/uptimer: direct link, hf CLI and curl.
- Browser
- Download file 774 Bytes
-
https://huggingface.co/spaces/srinetwork/uptimer/resolve/main/app.py
- Command line
-
hf download hf://spaces/srinetwork/uptimer/app.py
-
curl -L -o app.py https://huggingface.co/spaces/srinetwork/uptimer/resolve/main/app.py
774 Bytes
| import requests | |
| import gradio as gr | |
| # 👉 මෙතන links add කරන්න | |
| URLS = [ | |
| "https://srinetwork-api.hf.space", | |
| "https://srinetwork-uptimer.hf.space", | |
| "https://srinetwork-api.hf.space" | |
| ] | |
| def check_urls(): | |
| results = [] | |
| for url in URLS: | |
| try: | |
| response = requests.get(url, timeout=5) | |
| status = f"🟢 UP ({response.status_code})" | |
| except: | |
| status = "🔴 DOWN" | |
| results.append([url, status]) | |
| return results | |
| def refresh(): | |
| return check_urls() | |
| with gr.Blocks() as app: | |
| gr.Markdown("# 🌐 Simple Uptime Monitor") | |
| table = gr.Dataframe(headers=["URL", "Status"], value=check_urls()) | |
| btn = gr.Button("🔄 Refresh") | |
| btn.click(refresh, outputs=table) | |
| app.launch() |