htchu Claude Opus 4.6 commited on
Commit
85f60ba
·
1 Parent(s): 5ae7dfb

fix: 適配 Gradio 6.x API(移除 type 參數,theme 移至 launch)

Browse files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +11 -36
app.py CHANGED
@@ -112,41 +112,16 @@ def respond(message, history):
112
  yield response
113
 
114
 
115
- with gr.Blocks(
116
- title="嶺東科大 AI系學習問答系統",
117
- theme=gr.themes.Soft(primary_hue="blue", secondary_hue="sky"),
118
- css="""
119
- .header { text-align: center; margin-bottom: 10px; }
120
- .header h1 { color: #1a5276; margin-bottom: 5px; }
121
- .header p { color: #555; font-size: 14px; }
122
- .examples-row { margin-top: 10px; }
123
- """
124
- ) as demo:
125
-
126
- gr.HTML("""
127
- <div class="header">
128
- <h1>🎓 嶺東科技大學 人工智慧應用科技系</h1>
129
- <h3>AI 學習內容與出路問答系統</h3>
130
- <p>歡迎詢問課程規劃、職涯發展、教學設備等問題|支援中文與英文問答</p>
131
- </div>
132
- """)
133
-
134
- chatbot = gr.ChatInterface(
135
- fn=respond,
136
- type="messages",
137
- examples=EXAMPLES,
138
- examples_per_page=4,
139
- chatbot=gr.Chatbot(height=480, placeholder="💬 請輸入您的問題,例如:大一要上哪些課?"),
140
- )
141
-
142
- gr.HTML("""
143
- <div style="text-align:center; margin-top:15px; padding:10px; background:#f0f4f8; border-radius:8px;">
144
- <p style="margin:0; color:#666; font-size:13px;">
145
- 📍 台中市南屯區嶺東路一號 仙庭樓5樓 HT506 | ☎ 04-2389-2088 #3751 |
146
- 🌐 <a href="https://ai.ltu.edu.tw/" target="_blank">ai.ltu.edu.tw</a>
147
- </p>
148
- </div>
149
- """)
150
 
151
  if __name__ == "__main__":
152
- demo.launch()
 
 
 
112
  yield response
113
 
114
 
115
+ demo = gr.ChatInterface(
116
+ fn=respond,
117
+ examples=EXAMPLES,
118
+ examples_per_page=4,
119
+ chatbot=gr.Chatbot(height=480, placeholder="💬 請輸入您的問題,例如:大一要上哪些課?"),
120
+ title="🎓 嶺東科技大學 人工智慧應用科技系",
121
+ description="AI 學習內容與出路問答系統|歡迎詢問課程規劃、職涯發展、教學設備等問題|支援中文與英文問答",
122
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
 
124
  if __name__ == "__main__":
125
+ demo.launch(
126
+ theme=gr.themes.Soft(primary_hue="blue", secondary_hue="sky"),
127
+ )