|
import gradio as gr |
|
import os |
|
from datetime import datetime |
|
|
|
|
|
firebase_keys = [ |
|
"FIREBASE_API_KEY", |
|
"FIREBASE_URL" |
|
] |
|
|
|
|
|
def display_info(): |
|
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S") |
|
|
|
content = f"## ⏰ Thời gian hiện tại:\n{current_time}\n\n" |
|
content += "## 🔐 Danh sách các biến Firebase:\n" |
|
|
|
for key in firebase_keys: |
|
status = "✅ Đã lấy thành công" if os.getenv(key) else "❌ Chưa có" |
|
content += f"- **{key}**: {status}\n" |
|
|
|
return content |
|
|
|
|
|
with gr.Blocks() as demo: |
|
gr.Markdown("## Realtime Hiển thị Thời gian & Biến Firebase (Ẩn giá trị vì bảo mật)") |
|
|
|
output = gr.Markdown(display_info) |
|
|
|
|
|
gr.Timer(display_info, every=1, outputs=output) |
|
|
|
demo.launch() |
|
|