srinetwork commited on
Commit
225a0cf
·
verified ·
1 Parent(s): 7ca4cdd

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -0
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import gradio as gr
3
+
4
+ # 👉 මෙතන links add කරන්න
5
+ URLS = [
6
+ "https://google.com",
7
+ "https://github.com",
8
+ "https://example.com"
9
+ ]
10
+
11
+ def check_urls():
12
+ results = []
13
+ for url in URLS:
14
+ try:
15
+ response = requests.get(url, timeout=5)
16
+ status = f"🟢 UP ({response.status_code})"
17
+ except:
18
+ status = "🔴 DOWN"
19
+ results.append([url, status])
20
+ return results
21
+
22
+ def refresh():
23
+ return check_urls()
24
+
25
+ with gr.Blocks() as app:
26
+ gr.Markdown("# 🌐 Simple Uptime Monitor")
27
+
28
+ table = gr.Dataframe(headers=["URL", "Status"], value=check_urls())
29
+
30
+ btn = gr.Button("🔄 Refresh")
31
+ btn.click(refresh, outputs=table)
32
+
33
+ app.launch()