1105 / app_combined.py
smartTranscend's picture
Rename app_combined (2).py to app_combined.py
3e79c46 verified
import streamlit as st
import os
# 設置頁面配置
st.set_page_config(
page_title="精準傳染病防疫-元宇宙時間數位雙胞胎模型",
page_icon="🦠",
layout="wide"
)
# 初始化 session state - 直接從環境變數讀取
if 'api_key' not in st.session_state:
st.session_state.api_key = os.getenv("OPENAI_API_KEY", "") # 從環境變數讀取
# 主標題
st.title("🦠 精準傳染病防疫-元宇宙時間數位雙胞胎模型")
st.markdown("透過 AI 深度學習模型,根據確診者的病毒量(Ct值)操縱最佳追蹤策略")
# 側邊欄 - API Key 設定(兩個分頁共用)
with st.sidebar:
st.markdown("---")
st.markdown("""
### 📖 系統說明
**分頁1: 接觸者追蹤**
- 基於 Alpha 變異株
- 問題:確診者要往回追蹤幾天?
**分頁2: 隔離檢疫**
- 基於 Omicron 變異株
- 問題:接觸者要隔離幾天?
""")
# 創建分頁
tab1, tab2 = st.tabs(["📊 接觸者追蹤 ", "🏥 隔離檢疫 "])
with tab1:
# 導入原有的 Table 1 系統
import tab1_contact_tracing
tab1_contact_tracing.render()
with tab2:
# 導入新的 Table 2 系統
import tab2_quarantine
tab2_quarantine.render()
# 頁腳
st.markdown("---")
st.markdown("""
<div style='text-align: center; color: gray; font-size: 12px;'>
<p>📖 數據來源: Lin et al. (2025) - A Bayesian Digital Twin Model for Precision Control of Emerging Infectious Diseases</p>
<p>🤖 AI 功能: 使用 OpenAI GPT-4 模型提供智能分析</p>
<p>⚠️ 本工具僅供參考,實際防疫策略需由專業人員評估</p>
</div>
""", unsafe_allow_html=True)