File size: 700 Bytes
57b8366
 
 
 
 
 
 
 
 
 
 
 
 
 
744cd23
 
57b8366
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# app.py
from core.visits import get_and_update_visits
from ui.layouts import create_ui

# --- 1. Update site visit count on startup ---
# This part runs only once when the application starts.
try:
    count = get_and_update_visits()
    visit_count_html = f"🚀 **總載入次數:** {count}"
    print(f"Application loaded. Total visits: {count}")
except Exception as e:
    visit_count_html = "🚀 **總載入次數:** N/A"
    print(f"Could not update visit count: {e}")

# --- 2. Create the main UI by passing the dynamic content into the layout function ---
demo = create_ui(visit_count_html)

# --- 3. Launch the application ---
if __name__ == "__main__":
    demo.launch()