SiangKai commited on
Commit
69da87b
·
verified ·
1 Parent(s): b3aa2e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -1
app.py CHANGED
@@ -730,7 +730,21 @@ def gradio_interface(user_input):
730
  yield "❌ 查詢失敗", f"發生未預期的系統錯誤:{str(e)}"
731
 
732
  # --- UI 介面定義 ---
733
- with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="orange")) as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
734
  gr.Markdown(
735
  """
736
  # 🤖 高雄市公務統計資料智慧查詢
@@ -776,6 +790,8 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="orange"))
776
  )
777
  output_result = gr.Markdown(
778
  label="🧐 查詢結果",
 
 
779
  )
780
 
781
  gr.Markdown(
 
730
  yield "❌ 查詢失敗", f"發生未預期的系統錯誤:{str(e)}"
731
 
732
  # --- UI 介面定義 ---
733
+ # 1. 定義自訂 CSS 樣式
734
+ custom_css = """
735
+ /* 針對我們指定的 Markdown 區塊進行樣式設定 */
736
+ #output_markdown {
737
+ padding: 15px; /* 增加一些內部邊距,讓文字不會貼著邊框 */
738
+ border-radius: 8px; /* 圓角效果 */
739
+ background: #f9fafb; /* 設定一個淡淡的背景色,與 Group 區別開 */
740
+ max-height: 400px; /* 設定最大高度,例如 400px */
741
+ overflow-y: auto; /* 當內容超出最大高度時,顯示垂直滾動條 */
742
+ box-shadow: inset 0 2px 4px 0 rgba(0,0,0,0.05); /* 增加一點內陰影,更有層次感 */
743
+ }
744
+ """
745
+
746
+ # 2. 在 gr.Blocks 中載入 CSS
747
+ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="orange"), css=custom_css) as demo:
748
  gr.Markdown(
749
  """
750
  # 🤖 高雄市公務統計資料智慧查詢
 
790
  )
791
  output_result = gr.Markdown(
792
  label="🧐 查詢結果",
793
+ show_label=True,
794
+ elem_id="output_markdown"
795
  )
796
 
797
  gr.Markdown(