File size: 774 Bytes
225a0cf
 
 
 
 
c26ac6a
931dc65
eba3013
225a0cf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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()