JJS341 commited on
Commit
0acc491
·
verified ·
1 Parent(s): 4a8cfba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -111,9 +111,9 @@ def coref_learning_pipeline(user_input):
111
  except Exception as e:
112
  return f"錯誤: {str(e)}", "無法整合單字", f"運行異常: {str(e)}"
113
 
114
- # 6. 精美 UI 介面設計
115
- with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="indigo")) as demo:
116
- gr.Markdown("# 🤖 AI 跨語言智慧語意學習終端")
117
  gr.Markdown("### 🚀 專題亮點:結合核心指代消解 (Coreference Resolution) 與 NLP 智慧名詞提取技術")
118
 
119
  with gr.Row():
@@ -126,12 +126,10 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="indigo"))
126
  btn_submit = gr.Button("🔥 執行多維度 AI 語意解析", variant="primary")
127
 
128
  with gr.Column(scale=1):
129
- # 前端三個輸出元件定義
130
  out_translation = gr.Textbox(label="📖 完整文本翻譯/對照 (Translation/Context)", lines=3)
131
  out_vocab = gr.Textbox(label="📚 AI 智慧單字本 (Vocabulary Booklet)", lines=5)
132
  out_report = gr.Textbox(label="🎯 AI 語意消解報告 (Coreference Report)", lines=5)
133
 
134
- # 點擊按鈕時,將三個輸出結果精準對接到各自的 Textbox 組件
135
  btn_submit.click(
136
  fn=coref_learning_pipeline,
137
  inputs=txt_input,
@@ -139,4 +137,5 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="indigo"))
139
  )
140
 
141
  if __name__ == "__main__":
142
- demo.launch()
 
 
111
  except Exception as e:
112
  return f"錯誤: {str(e)}", "無法整合單字", f"運行異常: {str(e)}"
113
 
114
+ # 6. 精美 UI 介面設計 (將 theme 移出 Blocks 構造函數)
115
+ with gr.Blocks() as demo:
116
+ gr.Markdown("# 🤖 Janice's AI 跨語言智慧語意學習終端")
117
  gr.Markdown("### 🚀 專題亮點:結合核心指代消解 (Coreference Resolution) 與 NLP 智慧名詞提取技術")
118
 
119
  with gr.Row():
 
126
  btn_submit = gr.Button("🔥 執行多維度 AI 語意解析", variant="primary")
127
 
128
  with gr.Column(scale=1):
 
129
  out_translation = gr.Textbox(label="📖 完整文本翻譯/對照 (Translation/Context)", lines=3)
130
  out_vocab = gr.Textbox(label="📚 AI 智慧單字本 (Vocabulary Booklet)", lines=5)
131
  out_report = gr.Textbox(label="🎯 AI 語意消解報告 (Coreference Report)", lines=5)
132
 
 
133
  btn_submit.click(
134
  fn=coref_learning_pipeline,
135
  inputs=txt_input,
 
137
  )
138
 
139
  if __name__ == "__main__":
140
+ # ✨ 關鍵修正:按照最新規範,將 theme 傳入 launch() 方法中
141
+ demo.launch(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="indigo"))