Spaces:
Sleeping
Sleeping
Steven Chen commited on
Update app.py
Browse files266 unmodified lines2672682692702712722732742752762772782792802812829 unmodified lines292293294295296297298299300301302303304305306307308309310311312313266 unmodified lines# 创建Gradio ChatInterfacedemo = gr.ChatInterface(respond,title="⚖️ Legal RAG Assistant",description="🤖 AI法律助手,结合向量数据库搜索和大语言模型,为您提供准确的法律信息咨询。",examples=["What are the fall protection requirements in Ontario construction?","Tell me about employer duties under Canada Labour Code","What are my rights under the Charter of Rights and Freedoms?","Search for information about workplace safety regulations","What consumer protection laws exist in Canada?"],additional_inputs=[gr.Textbox(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.",9 unmodified linesstep=0.05,label="Top-p (nucleus sampling)",),],theme=gr.themes.Soft(),css=""".gradio-container {max-width: 1000px !important;margin: auto !important;}.chat-message {font-size: 14px !important;}""",)# 添加状态显示if chatbot:demo.description += f"\n\n✅ **Status**: Connected to database with {chatbot.collection_name} collection"else:demo.description += f"\n\n❌ **Status**: Configuration error - please check environment variables"266 unmodified lines2672682692702712722732742759 unmodified lines285286287288289290291292293294295296297266 unmodified lines# 创建Gradio ChatInterfacedemo = gr.ChatInterface(fn=respond,title="⚖️ Legal RAG Assistant",description="🤖 AI法律助手,结合向量数据库搜索和大语言模型,为您提供准确的法律信息咨询。",additional_inputs=[gr.Textbox(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.",9 unmodified linesstep=0.05,label="Top-p (nucleus sampling)",),])# 添加状态显示和示例问题if chatbot:demo.description += f"\n\n✅ **Status**: Connected to database with {chatbot.collection_name} collection"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"else:demo.description += f"\n\n❌ **Status**: Configuration error - please check environment variables"
app.py+4-20