"""
ProVerBs Legal AI - Enhanced Landing Page
Multi-Module Legal AI Platform with Professional UI
"""
import gradio as gr
from huggingface_hub import InferenceClient
def respond(
message,
history: list[dict[str, str]],
system_message,
max_tokens,
temperature,
top_p,
hf_token: gr.OAuthToken,
):
"""
Main chat response function with AI integration
"""
client = InferenceClient(token=hf_token.token, model="meta-llama/Llama-3.3-70B-Instruct")
messages = [{"role": "system", "content": system_message}]
messages.extend(history)
messages.append({"role": "user", "content": message})
response = ""
for message in client.chat_completion(
messages,
max_tokens=max_tokens,
stream=True,
temperature=temperature,
top_p=top_p,
):
choices = message.choices
token = ""
if len(choices) and choices[0].delta.content:
token = choices[0].delta.content
response += token
yield response
# Custom CSS for professional styling
custom_css = """
.gradio-container {
max-width: 1200px !important;
}
.header-section {
text-align: center;
padding: 40px 20px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border-radius: 12px;
margin-bottom: 30px;
}
.header-section h1 {
font-size: 3rem;
margin-bottom: 10px;
font-weight: 700;
}
.header-section p {
font-size: 1.2rem;
opacity: 0.95;
}
.feature-card {
border: 2px solid #e0e0e0;
border-radius: 12px;
padding: 20px;
margin: 10px;
transition: all 0.3s;
}
.feature-card:hover {
border-color: #667eea;
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}
.tab-nav button {
font-size: 16px;
font-weight: 600;
}
"""
# Create the main application
with gr.Blocks(
theme=gr.themes.Soft(
primary_hue="purple",
secondary_hue="blue",
),
css=custom_css,
title="ProVerBs Legal AI Platform"
) as demo:
# Header Section
gr.HTML("""
""")
# Login Section
with gr.Row():
with gr.Column(scale=1):
gr.LoginButton(size="lg")
with gr.Column(scale=5):
gr.Markdown("đ **Login with your Hugging Face account** for full access to premium features")
gr.Markdown("---")
# Main Content Tabs
with gr.Tabs() as tabs:
# Tab 1: Welcome & Overview
with gr.Tab("đ Welcome", id="welcome"):
gr.Markdown("""
## Welcome to ProVerBs Legal AI Platform
A comprehensive legal AI system designed for legal professionals, researchers, and individuals
seeking legal information. Our platform combines multiple AI models and specialized tools to
provide accurate, helpful legal assistance.
### đ Key Features
- **đ¤ AI Legal Assistant**: Chat with advanced AI models trained on legal knowledge
- **đ Document Analysis**: Process and analyze legal documents
- **đŧ Case Management**: Track and manage legal cases efficiently
- **đ Legal Research**: Access vast databases of legal information
- **đĄī¸ Compliance Tools**: Ensure regulatory compliance
- **đ Analytics Dashboard**: Visualize legal data and insights
### đ¯ Our Mission
To democratize access to legal information and tools, making professional-grade legal AI
accessible to everyone while maintaining the highest standards of accuracy and reliability.
### â ī¸ Important Disclaimer
This platform provides general legal information and AI-powered assistance. It does not
constitute legal advice. Always consult with a qualified attorney for specific legal matters.
---
**Ready to get started?** Click on the "Legal AI Assistant" tab to begin chatting!
""")
# Tab 2: Legal AI Assistant (Main Chat)
with gr.Tab("đ¤ Legal AI Assistant", id="assistant"):
gr.Markdown("""
## Legal AI Assistant
Ask questions about law, legal procedures, case analysis, or any legal topic.
Our AI assistant is here to help with accurate, contextual information.
""")
chatbot = gr.ChatInterface(
respond,
type="messages",
chatbot=gr.Chatbot(
height=500,
placeholder="đŦ Ask me anything about law, legal procedures, or case analysis...",
show_label=False,
),
textbox=gr.Textbox(
placeholder="Type your legal question here...",
container=False,
scale=7
),
additional_inputs=[
gr.Textbox(
value="You are ProVerBs Legal AI, a knowledgeable legal assistant specializing in law, legal procedures, and case analysis. Provide accurate, helpful information while noting that you cannot provide legal advice. Always recommend consulting with a licensed attorney for specific legal matters. Be professional, thorough, and cite relevant legal principles when possible.",
label="System Message",
lines=4
),
gr.Slider(
minimum=128,
maximum=4096,
value=2048,
step=128,
label="Max Tokens"
),
gr.Slider(
minimum=0.1,
maximum=2.0,
value=0.7,
step=0.1,
label="Temperature"
),
gr.Slider(
minimum=0.1,
maximum=1.0,
value=0.95,
step=0.05,
label="Top-p (nucleus sampling)"
),
],
examples=[
["What is the difference between civil law and criminal law?"],
["Explain the concept of 'burden of proof' in legal proceedings"],
["What are the essential elements of a valid contract?"],
["What is the statute of limitations and why is it important?"],
["Explain the difference between 'lawful' and 'legal'"],
],
cache_examples=False,
)
# Tab 3: Features Overview
with gr.Tab("⨠Features", id="features"):
gr.Markdown("""
## Platform Features
### đ¯ Core Capabilities
""")
with gr.Row():
with gr.Column():
gr.Markdown("""
#### đ¤ AI-Powered Assistance
- Multiple AI models (Llama, GPT, Qwen)
- Real-time streaming responses
- Context-aware conversations
- Legal knowledge base integration
""")
with gr.Column():
gr.Markdown("""
#### đ Document Processing
- PDF, DOCX, TXT support
- Automatic text extraction
- Key terms identification
- Legal issue detection
""")
with gr.Row():
with gr.Column():
gr.Markdown("""
#### đŧ Case Management
- Track multiple cases
- Client information management
- Deadline tracking
- Status monitoring
""")
with gr.Column():
gr.Markdown("""
#### đ Research Tools
- Case law search
- Statute lookup
- Legal precedent finder
- Citation generator
""")
gr.Markdown("""
---
### đ Coming Soon
- **Advanced Analytics**: Visualize case trends and patterns
- **Multi-language Support**: Legal assistance in multiple languages
- **API Access**: Integrate with your existing tools
- **Team Collaboration**: Share workspaces with colleagues
- **Mobile App**: Access on the go
""")
# Tab 4: About & Resources
with gr.Tab("âšī¸ About", id="about"):
gr.Markdown("""
## About ProVerBs Legal AI
### đ Our Story
ProVerBs Legal AI is a cutting-edge platform that combines artificial intelligence with
legal expertise to provide accessible, accurate legal information and tools. We believe
that everyone deserves access to quality legal resources.
### đĨ For Everyone
- **Legal Professionals**: Enhance your practice with AI-powered tools
- **Law Students**: Study and research with advanced AI assistance
- **Businesses**: Understand legal implications of business decisions
- **Individuals**: Get information about your legal rights and options
### đ Privacy & Security
We take your privacy seriously:
- End-to-end encryption for sensitive data
- No storage of personal information without consent
- GDPR and CCPA compliant
- Secure OAuth authentication via Hugging Face
### đ Resources
- **Documentation**: [Read the Docs](https://huggingface.co/Solomon7890)
- **GitHub**: [Source Code](https://github.com/Solomon7890)
- **Community**: [Join our Discord](#)
- **Support**: [Contact Us](#)
### đ¤ Credits
Built with:
- [Gradio](https://gradio.app) - UI Framework
- [Hugging Face](https://huggingface.co) - AI Infrastructure
- [Meta Llama](https://llama.meta.com) - Language Models
### đ License
This project is released under the Unlicense - free for any use.
---
**Version 1.0.0** | Last Updated: 2024 | Built by Solomon7890
""")
# Footer
gr.Markdown("""
---
âī¸ ProVerBs Legal AI Platform | Version 1.0.0
Hugging Face |
GitHub |
Documentation |
Support
â ī¸ Disclaimer: This AI provides general legal information only.
It does not constitute legal advice. Consult with a licensed attorney for specific legal matters.
Š 2024 ProVerBs Legal AI. Built with â¤ī¸ for legal professionals worldwide.
""")
if __name__ == "__main__":
demo.queue(max_size=20)
demo.launch(
server_name="0.0.0.0",
server_port=7860,
share=False,
show_error=True
)