StevenChen16 commited on
Commit
5eecf0a
·
verified ·
1 Parent(s): 13ec311

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -20
app.py CHANGED
@@ -267,16 +267,9 @@ def respond(
267
 
268
  # 创建Gradio ChatInterface
269
  demo = gr.ChatInterface(
270
- respond,
271
  title="⚖️ Legal RAG Assistant",
272
  description="🤖 AI法律助手,结合向量数据库搜索和大语言模型,为您提供准确的法律信息咨询。",
273
- examples=[
274
- "What are the fall protection requirements in Ontario construction?",
275
- "Tell me about employer duties under Canada Labour Code",
276
- "What are my rights under the Charter of Rights and Freedoms?",
277
- "Search for information about workplace safety regulations",
278
- "What consumer protection laws exist in Canada?"
279
- ],
280
  additional_inputs=[
281
  gr.Textbox(
282
  value="You are a helpful legal assistant with expertise in Canadian law. You have access to a legal database and should provide accurate, well-sourced legal information. Always cite specific legal sources when possible. Remember to include appropriate disclaimers that this is for informational purposes only and not legal advice.",
@@ -292,22 +285,13 @@ demo = gr.ChatInterface(
292
  step=0.05,
293
  label="Top-p (nucleus sampling)",
294
  ),
295
- ],
296
- theme=gr.themes.Soft(),
297
- css="""
298
- .gradio-container {
299
- max-width: 1000px !important;
300
- margin: auto !important;
301
- }
302
- .chat-message {
303
- font-size: 14px !important;
304
- }
305
- """,
306
  )
307
 
308
- # 添加状态显示
309
  if chatbot:
310
  demo.description += f"\n\n✅ **Status**: Connected to database with {chatbot.collection_name} collection"
 
311
  else:
312
  demo.description += f"\n\n❌ **Status**: Configuration error - please check environment variables"
313
 
 
267
 
268
  # 创建Gradio ChatInterface
269
  demo = gr.ChatInterface(
270
+ fn=respond,
271
  title="⚖️ Legal RAG Assistant",
272
  description="🤖 AI法律助手,结合向量数据库搜索和大语言模型,为您提供准确的法律信息咨询。",
 
 
 
 
 
 
 
273
  additional_inputs=[
274
  gr.Textbox(
275
  value="You are a helpful legal assistant with expertise in Canadian law. You have access to a legal database and should provide accurate, well-sourced legal information. Always cite specific legal sources when possible. Remember to include appropriate disclaimers that this is for informational purposes only and not legal advice.",
 
285
  step=0.05,
286
  label="Top-p (nucleus sampling)",
287
  ),
288
+ ]
 
 
 
 
 
 
 
 
 
 
289
  )
290
 
291
+ # 添加状态显示和示例问题
292
  if chatbot:
293
  demo.description += f"\n\n✅ **Status**: Connected to database with {chatbot.collection_name} collection"
294
+ demo.description += f"\n\n💡 **Try asking:**\n• What are the fall protection requirements in Ontario construction?\n• Tell me about employer duties under Canada Labour Code\n• What are my rights under the Charter of Rights and Freedoms?\n• Search for information about workplace safety regulations"
295
  else:
296
  demo.description += f"\n\n❌ **Status**: Configuration error - please check environment variables"
297