File size: 1,040 Bytes
a4af348
6690bf8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
34
35
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()