cwadayi commited on
Commit
fb13531
·
verified ·
1 Parent(s): d75a620

Upload 9 files

Browse files
Files changed (1) hide show
  1. ui/layouts.py +11 -4
ui/layouts.py CHANGED
@@ -14,22 +14,30 @@ def create_ui(visit_count_html: str, theme: gr.Theme):
14
 
15
  # --- Main UI Layout ---
16
  with gr.Blocks(theme=theme, title="地球物理學與AI應用") as demo:
17
- # (此處程式碼不變,省略以節省篇幅)
18
  gr.Markdown(visit_count_html)
 
 
19
  gr.Markdown(content.course_introduction_md)
20
 
 
21
  with gr.Tabs():
 
22
  with gr.TabItem("🎯 課程目標"):
23
  gr.Markdown(content.course_goals_md)
 
24
  with gr.TabItem("🗓️ 課程進度"):
25
  gr.Markdown("### 每週課程安排")
26
  gr.DataFrame(data.schedule_df, wrap=True)
 
27
  with gr.TabItem("💯 成績計算"):
28
  gr.Markdown(content.grading_policy_md)
 
29
  with gr.TabItem("🚀 互動體驗區 (程式碼實驗室)"):
30
  gr.Markdown("## 🚀 互動程式碼實驗室")
31
  gr.Markdown("歡迎來到這裡!直接修改下方的 Python 程式碼,點擊「執行」,即可在右側看到成果。這是學習程式與地球物理最直接的方式!")
32
  gr.Info("注意:執行環境已受限,僅支援資料視覺化相關操作。請勿嘗試檔案讀寫或網路請求。")
 
33
  with gr.Accordion("🌍 地圖繪製實驗室 (PyGMT/Cartopy 概念)", open=True):
34
  with gr.Row():
35
  with gr.Column(scale=2):
@@ -39,6 +47,7 @@ def create_ui(visit_count_html: str, theme: gr.Theme):
39
  with gr.Column(scale=3):
40
  map_plot_output = gr.Plot(label="地圖輸出")
41
  map_console_output = gr.Textbox(label="執行結果 / 錯誤訊息", lines=8, interactive=False)
 
42
  with gr.Accordion("📈 震波圖繪製實驗室 (ObsPy 概念)", open=False):
43
  with gr.Row():
44
  with gr.Column(scale=2):
@@ -49,11 +58,10 @@ def create_ui(visit_count_html: str, theme: gr.Theme):
49
  seismo_plot_output = gr.Plot(label="震波圖輸出")
50
  seismo_console_output = gr.Textbox(label="執行結果 / 錯誤訊息", lines=8, interactive=False)
51
 
52
- # --- ✨ Tab 5: AI Chatbot (with improved description and textbox) --- ✨
53
  with gr.TabItem("🤖 AI 課程助教"):
 
54
  with gr.Group():
55
  gr.Markdown("### 🤖 AI 課程助教 (知識庫強化版)")
56
- # --- ✨ 1. Strengthened description ---
57
  gr.Markdown("""
58
  歡迎使用課程 AI 助教!這裡整合了課程的關鍵資訊,您可以隨時向我提問。
59
 
@@ -65,7 +73,6 @@ def create_ui(visit_count_html: str, theme: gr.Theme):
65
  我能理解錯別字或不完全精確的提問,請隨意發問!
66
  """)
67
 
68
- # --- ✨ 2. Customized textbox for the chat interface ---
69
  custom_textbox = gr.Textbox(
70
  placeholder="對課程有什麼問題嗎?在這裡試著問我!",
71
  show_label=False,
 
14
 
15
  # --- Main UI Layout ---
16
  with gr.Blocks(theme=theme, title="地球物理學與AI應用") as demo:
17
+ # --- Display Visit Counter at the top ---
18
  gr.Markdown(visit_count_html)
19
+
20
+ # --- Introduction Section ---
21
  gr.Markdown(content.course_introduction_md)
22
 
23
+ # --- Main Tabs ---
24
  with gr.Tabs():
25
+
26
  with gr.TabItem("🎯 課程目標"):
27
  gr.Markdown(content.course_goals_md)
28
+
29
  with gr.TabItem("🗓️ 課程進度"):
30
  gr.Markdown("### 每週課程安排")
31
  gr.DataFrame(data.schedule_df, wrap=True)
32
+
33
  with gr.TabItem("💯 成績計算"):
34
  gr.Markdown(content.grading_policy_md)
35
+
36
  with gr.TabItem("🚀 互動體驗區 (程式碼實驗室)"):
37
  gr.Markdown("## 🚀 互動程式碼實驗室")
38
  gr.Markdown("歡迎來到這裡!直接修改下方的 Python 程式碼,點擊「執行」,即可在右側看到成果。這是學習程式與地球物理最直接的方式!")
39
  gr.Info("注意:執行環境已受限,僅支援資料視覺化相關操作。請勿嘗試檔案讀寫或網路請求。")
40
+
41
  with gr.Accordion("🌍 地圖繪製實驗室 (PyGMT/Cartopy 概念)", open=True):
42
  with gr.Row():
43
  with gr.Column(scale=2):
 
47
  with gr.Column(scale=3):
48
  map_plot_output = gr.Plot(label="地圖輸出")
49
  map_console_output = gr.Textbox(label="執行結果 / 錯誤訊息", lines=8, interactive=False)
50
+
51
  with gr.Accordion("📈 震波圖繪製實驗室 (ObsPy 概念)", open=False):
52
  with gr.Row():
53
  with gr.Column(scale=2):
 
58
  seismo_plot_output = gr.Plot(label="震波圖輸出")
59
  seismo_console_output = gr.Textbox(label="執行結果 / 錯誤訊息", lines=8, interactive=False)
60
 
 
61
  with gr.TabItem("🤖 AI 課程助教"):
62
+ # Use gr.Group for backward compatibility with older Gradio versions
63
  with gr.Group():
64
  gr.Markdown("### 🤖 AI 課程助教 (知識庫強化版)")
 
65
  gr.Markdown("""
66
  歡迎使用課程 AI 助教!這裡整合了課程的關鍵資訊,您可以隨時向我提問。
67
 
 
73
  我能理解錯別字或不完全精確的提問,請隨意發問!
74
  """)
75
 
 
76
  custom_textbox = gr.Textbox(
77
  placeholder="對課程有什麼問題嗎?在這裡試著問我!",
78
  show_label=False,