Create safe_app.py
Browse files- safe_app.py +18 -0
safe_app.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# safe_app.py — minimal heartbeat app for Spaces
|
| 2 |
+
import os, platform, datetime, gradio as gr
|
| 3 |
+
|
| 4 |
+
def ping():
|
| 5 |
+
return (
|
| 6 |
+
f"✅ Space is alive\n"
|
| 7 |
+
f"Time: {datetime.datetime.utcnow().isoformat()}Z\n"
|
| 8 |
+
f"Python: {platform.python_version()}\n"
|
| 9 |
+
f"Host: {os.uname().sysname} {os.uname().release}"
|
| 10 |
+
)
|
| 11 |
+
|
| 12 |
+
with gr.Blocks() as demo:
|
| 13 |
+
gr.Markdown("# Safe mode / heartbeat")
|
| 14 |
+
btn = gr.Button("Ping")
|
| 15 |
+
out = gr.Textbox(lines=4)
|
| 16 |
+
btn.click(fn=ping, outputs=out)
|
| 17 |
+
|
| 18 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|