Spaces:
Running
Running
Upload 9 files
Browse files- ui/layouts.py +3 -5
ui/layouts.py
CHANGED
|
@@ -40,7 +40,6 @@ def create_ui(visit_count_html: str, theme: gr.Theme):
|
|
| 40 |
gr.Info("注意:執行環境已受限,僅支援資料視覺化相關操作。請勿嘗試檔案讀寫或網路請求。")
|
| 41 |
|
| 42 |
with gr.Accordion("🌍 地圖繪製實驗室 (PyGMT/Cartopy 概念)", open=True):
|
| 43 |
-
# ... (此處內容不變)
|
| 44 |
with gr.Row():
|
| 45 |
with gr.Column(scale=2):
|
| 46 |
gr.Markdown("### 說明\n這段程式碼使用 `cartopy` 和 `matplotlib` 函式庫來繪製地理地圖。\n\n**您可以試著:**\n1. 修改 `center_lon`, `center_lat` 來改變地圖中心。\n2. 調整 `extent_lon`, `extent_lat` 來縮放地圖。\n3. 將 `coastline_color` 改成 'red' 或其他顏色。\n4. **在 `symbols` 列表中新增或修改字典,來繪製自訂的符號(例如:標示您所在的城市)。**")
|
|
@@ -51,7 +50,6 @@ def create_ui(visit_count_html: str, theme: gr.Theme):
|
|
| 51 |
map_console_output = gr.Textbox(label="執行結果 / 錯誤訊息", lines=8, interactive=False)
|
| 52 |
|
| 53 |
with gr.Accordion("📈 震波圖繪製實驗室 (ObsPy 概念)", open=False):
|
| 54 |
-
# ... (此處內容不變)
|
| 55 |
with gr.Row():
|
| 56 |
with gr.Column(scale=2):
|
| 57 |
gr.Markdown("### 說明\n這段程式碼使用 `numpy` 產生模擬的地震波數據,並用 `matplotlib` 將其視覺化。\n\n**您可以試著:**\n1. 修改 `p_wave_arrival` 和 `s_wave_arrival` 來改變 P/S 波的抵達時間。\n2. 調整 `main_freq` 來改變地震波的頻率(數值越大,波形越密集)。\n3. 將 `decay_rate` 調小,觀察振幅衰減變慢的效果。")
|
|
@@ -62,10 +60,10 @@ def create_ui(visit_count_html: str, theme: gr.Theme):
|
|
| 62 |
seismo_console_output = gr.Textbox(label="執行結果 / 錯誤訊息", lines=8, interactive=False)
|
| 63 |
|
| 64 |
|
| 65 |
-
# --- ✨ Tab 5: AI Chatbot (with
|
| 66 |
with gr.TabItem("🤖 AI 課程助教"):
|
| 67 |
-
# Use
|
| 68 |
-
with gr.
|
| 69 |
gr.Markdown("### 🤖 AI 課程助教 (知識庫強化版)")
|
| 70 |
gr.Markdown("我內建了豐富的課程知識庫,試著問我 **「如何安裝Python環境?」**、**「什麼是版本控制?」** 或 **「給我一些期末專題的靈感」**")
|
| 71 |
gr.ChatInterface(
|
|
|
|
| 40 |
gr.Info("注意:執行環境已受限,僅支援資料視覺化相關操作。請勿嘗試檔案讀寫或網路請求。")
|
| 41 |
|
| 42 |
with gr.Accordion("🌍 地圖繪製實驗室 (PyGMT/Cartopy 概念)", open=True):
|
|
|
|
| 43 |
with gr.Row():
|
| 44 |
with gr.Column(scale=2):
|
| 45 |
gr.Markdown("### 說明\n這段程式碼使用 `cartopy` 和 `matplotlib` 函式庫來繪製地理地圖。\n\n**您可以試著:**\n1. 修改 `center_lon`, `center_lat` 來改變地圖中心。\n2. 調整 `extent_lon`, `extent_lat` 來縮放地圖。\n3. 將 `coastline_color` 改成 'red' 或其他顏色。\n4. **在 `symbols` 列表中新增或修改字典,來繪製自訂的符號(例如:標示您所在的城市)。**")
|
|
|
|
| 50 |
map_console_output = gr.Textbox(label="執行結果 / 錯誤訊息", lines=8, interactive=False)
|
| 51 |
|
| 52 |
with gr.Accordion("📈 震波圖繪製實驗室 (ObsPy 概念)", open=False):
|
|
|
|
| 53 |
with gr.Row():
|
| 54 |
with gr.Column(scale=2):
|
| 55 |
gr.Markdown("### 說明\n這段程式碼使用 `numpy` 產生模擬的地震波數據,並用 `matplotlib` 將其視覺化。\n\n**您可以試著:**\n1. 修改 `p_wave_arrival` 和 `s_wave_arrival` 來改變 P/S 波的抵達時間。\n2. 調整 `main_freq` 來改變地震波的頻率(數值越大,波形越密集)。\n3. 將 `decay_rate` 調小,觀察振幅衰減變慢的效果。")
|
|
|
|
| 60 |
seismo_console_output = gr.Textbox(label="執行結果 / 錯誤訊息", lines=8, interactive=False)
|
| 61 |
|
| 62 |
|
| 63 |
+
# --- ✨ Tab 5: AI Chatbot (with corrected layout component) --- ✨
|
| 64 |
with gr.TabItem("🤖 AI 課程助教"):
|
| 65 |
+
# Use gr.Group for backward compatibility with older Gradio versions
|
| 66 |
+
with gr.Group():
|
| 67 |
gr.Markdown("### 🤖 AI 課程助教 (知識庫強化版)")
|
| 68 |
gr.Markdown("我內建了豐富的課程知識庫,試著問我 **「如何安裝Python環境?」**、**「什麼是版本控制?」** 或 **「給我一些期末專題的靈感」**")
|
| 69 |
gr.ChatInterface(
|