new-space / app.py
rapacious's picture
Update app.py
6690bf8 verified
raw
history blame
1.04 kB
import gradio as gr
import os
import time
from datetime import datetime
# Đọc firebase api key & url từ biến môi trường
FIREBASE_API_KEY = os.getenv("FIREBASE_API_KEY", "Not Found")
FIREBASE_URL = os.getenv("FIREBASE_URL", "Not Found")
# Ghép lại thành dict dễ show
firebase_info = {
"FIREBASE_API_KEY": FIREBASE_API_KEY,
"FIREBASE_URL": FIREBASE_URL
}
# Hàm cập nhật thời gian + show firebase info
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 += "### 🔐 Thông tin Firebase (từ Huggingface Secret):\n"
for key, value in firebase_info.items():
content += f"- **{key}**: {value}\n"
return content
with gr.Blocks() as demo:
gr.Markdown("## Demo Thời gian & Firebase Variables từ Huggingface Secret")
output = gr.Markdown(display_info)
refresh_btn = gr.Button("🔄 Refresh")
refresh_btn.click(fn=display_info, outputs=output)
demo.launch()