File size: 963 Bytes
a4af348
6690bf8
 
 
62124bc
6690bf8
 
 
 
 
 
 
 
62124bc
6690bf8
 
62124bc
 
6690bf8
 
 
 
62124bc
 
6690bf8
62124bc
6690bf8
 
 
62124bc
 
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
import gradio as gr
import os
from datetime import datetime

# Lấy biến môi trường (Firebase Secret)
FIREBASE_API_KEY = os.getenv("FIREBASE_API_KEY", "Not Found")
FIREBASE_URL = os.getenv("FIREBASE_URL", "Not Found")

firebase_info = {
    "FIREBASE_API_KEY": FIREBASE_API_KEY,
    "FIREBASE_URL": FIREBASE_URL
}

# Hàm tạo nội dung hiển thị
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 (lấy từ Huggingface Secrets):\n"
    for key, value in firebase_info.items():
        content += f"- **{key}**: {value}\n"
    return content


# Giao diện Gradio
with gr.Blocks() as demo:
    gr.Markdown("## Demo Auto Update Thời gian & Firebase Variables")

    output = gr.Markdown(display_info)

    # Timer auto update sau 1s
    gr.Timer(display_info, every=1, outputs=output)

demo.launch()