Spaces:
Sleeping
Sleeping
Upload app_bayesian.py
Browse files- app_bayesian.py +11 -25
app_bayesian.py
CHANGED
|
@@ -113,34 +113,20 @@ st.title("🎲 Bayesian Hierarchical Model Analysis")
|
|
| 113 |
st.markdown("### 寶可夢速度對勝率影響的貝氏階層分析")
|
| 114 |
st.markdown("---")
|
| 115 |
|
| 116 |
-
#
|
| 117 |
-
st.
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
["Google Gemini", "Anthropic Claude"],
|
| 122 |
-
help="選擇要使用的 AI 服務"
|
| 123 |
-
)
|
| 124 |
-
|
| 125 |
-
if llm_provider == "Google Gemini":
|
| 126 |
api_key = st.text_input(
|
| 127 |
"Google Gemini API Key",
|
| 128 |
type="password",
|
| 129 |
-
help="輸入您的 Google Gemini API Key"
|
| 130 |
-
)
|
| 131 |
-
api_url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp"
|
| 132 |
-
else: # Anthropic Claude
|
| 133 |
-
api_key = st.text_input(
|
| 134 |
-
"Anthropic Claude API Key",
|
| 135 |
-
type="password",
|
| 136 |
-
help="輸入您的 Anthropic API Key(從 https://console.anthropic.com/ 獲取)"
|
| 137 |
)
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
st.session_state.llm_provider = llm_provider
|
| 143 |
-
st.success(f"✅ {llm_provider} API Key 已載入")
|
| 144 |
|
| 145 |
st.markdown("---")
|
| 146 |
|
|
@@ -698,4 +684,4 @@ st.markdown(
|
|
| 698 |
</div>
|
| 699 |
""",
|
| 700 |
unsafe_allow_html=True
|
| 701 |
-
)
|
|
|
|
| 113 |
st.markdown("### 寶可夢速度對勝率影響的貝氏階層分析")
|
| 114 |
st.markdown("---")
|
| 115 |
|
| 116 |
+
# Sidebar
|
| 117 |
+
with st.sidebar:
|
| 118 |
+
st.header("⚙️ 配置設定")
|
| 119 |
+
|
| 120 |
+
# Google Gemini API Key
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
api_key = st.text_input(
|
| 122 |
"Google Gemini API Key",
|
| 123 |
type="password",
|
| 124 |
+
help="輸入您的 Google Gemini API Key 以使用 AI 助手"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
)
|
| 126 |
+
|
| 127 |
+
if api_key:
|
| 128 |
+
st.session_state.api_key = api_key
|
| 129 |
+
st.success("✅ API Key 已載入")
|
|
|
|
|
|
|
| 130 |
|
| 131 |
st.markdown("---")
|
| 132 |
|
|
|
|
| 684 |
</div>
|
| 685 |
""",
|
| 686 |
unsafe_allow_html=True
|
| 687 |
+
)
|