Solomon7890 commited on
Commit
d96041f
·
verified ·
1 Parent(s): 6c914fc

Deploy ProVerBs LaW with logo support

Browse files
Files changed (1) hide show
  1. app.py +538 -866
app.py CHANGED
@@ -1,866 +1,538 @@
1
- """
2
- ProVerBs Legal AI - Complete AI Integration
3
- Features: 7 AI Modes + Rotating Logos + DeepSeek-OCR + ERNIE-4.5-VL + GDPVAL
4
- """
5
-
6
- import gradio as gr
7
- from huggingface_hub import InferenceClient
8
- import json
9
- import os
10
- from datetime import datetime
11
- from typing import Dict, List, Optional
12
- import base64
13
- from pathlib import Path
14
-
15
- # AI Model Integration
16
- try:
17
- from transformers import pipeline, AutoModel
18
- from datasets import load_dataset
19
- AI_MODELS_AVAILABLE = True
20
- except ImportError:
21
- AI_MODELS_AVAILABLE = False
22
- print("⚠️ AI models not available. Install transformers and datasets.")
23
-
24
- class EnhancedAILegalChatbot:
25
- """
26
- Enhanced AI Legal Chatbot with multiple AI models
27
- - DeepSeek-OCR for document text extraction
28
- - ERNIE-4.5-VL for vision-language understanding
29
- - OpenAI GDPVAL dataset for legal knowledge
30
- """
31
-
32
- def __init__(self):
33
- self.specialized_modes = {
34
- "navigation": "Application Navigation Guide",
35
- "general": "General Legal Assistant",
36
- "document_validation": "Document Validator with OCR & Vision AI",
37
- "legal_research": "Legal Research Assistant with GDPVAL",
38
- "etymology": "Legal Etymology Lookup",
39
- "case_management": "Case Management Helper",
40
- "regulatory_updates": "Regulatory Update Monitor"
41
- }
42
-
43
- # Initialize AI models
44
- self.ocr_pipeline = None
45
- self.vision_pipeline = None
46
- self.gdpval_dataset = None
47
- self.minimax_pipeline = None
48
-
49
- if AI_MODELS_AVAILABLE:
50
- self._initialize_models()
51
-
52
- def _initialize_models(self):
53
- """Initialize all AI models"""
54
-
55
- # DeepSeek-OCR for text extraction
56
- try:
57
- print("📦 Loading DeepSeek-OCR...")
58
- self.ocr_pipeline = pipeline(
59
- "image-text-to-text",
60
- model="deepseek-ai/DeepSeek-OCR",
61
- trust_remote_code=True
62
- )
63
- print("✅ DeepSeek-OCR loaded!")
64
- except Exception as e:
65
- print(f"⚠️ DeepSeek-OCR not loaded: {e}")
66
-
67
- # ERNIE-4.5-VL for vision-language understanding
68
- try:
69
- print("📦 Loading ERNIE-4.5-VL (this may take a while)...")
70
- self.vision_pipeline = pipeline(
71
- "image-text-to-text",
72
- model="baidu/ERNIE-4.5-VL-28B-A3B-Thinking",
73
- trust_remote_code=True
74
- )
75
- print("✅ ERNIE-4.5-VL loaded!")
76
- except Exception as e:
77
- print(f"⚠️ ERNIE-4.5-VL not loaded: {e}")
78
-
79
- # OpenAI GDPVAL dataset for legal knowledge
80
- try:
81
- print("📦 Loading OpenAI GDPVAL dataset...")
82
- self.gdpval_dataset = load_dataset("openai/gdpval", split="train")
83
- print(f"✅ GDPVAL loaded! {len(self.gdpval_dataset)} entries")
84
- except Exception as e:
85
- print(f"⚠️ GDPVAL not loaded: {e}")
86
-
87
- # MiniMax-M2 for advanced text generation
88
- try:
89
- print("📦 Loading MiniMax-M2...")
90
- self.minimax_pipeline = pipeline(
91
- "text-generation",
92
- model="MiniMaxAI/MiniMax-M2",
93
- trust_remote_code=True
94
- )
95
- print(" MiniMax-M2 loaded!")
96
- except Exception as e:
97
- print(f"⚠️ MiniMax-M2 not loaded: {e}")
98
-
99
- def process_with_ocr(self, image_path: str) -> str:
100
- """Extract text using DeepSeek-OCR"""
101
- if not self.ocr_pipeline:
102
- return "❌ OCR not available"
103
-
104
- try:
105
- result = self.ocr_pipeline(image_path)
106
- return result[0]['generated_text'] if result else ""
107
- except Exception as e:
108
- return f"❌ OCR error: {str(e)}"
109
-
110
- def process_with_vision(self, image_url: str, question: str) -> str:
111
- """Analyze image using ERNIE-4.5-VL"""
112
- if not self.vision_pipeline:
113
- return "❌ Vision AI not available"
114
-
115
- try:
116
- messages = [
117
- {
118
- "role": "user",
119
- "content": [
120
- {"type": "image", "url": image_url},
121
- {"type": "text", "text": question}
122
- ]
123
- }
124
- ]
125
- result = self.vision_pipeline(text=messages)
126
- return result
127
- except Exception as e:
128
- return f"❌ Vision AI error: {str(e)}"
129
-
130
- def search_gdpval(self, query: str, limit: int = 5) -> str:
131
- """Search OpenAI GDPVAL dataset for legal knowledge"""
132
- if not self.gdpval_dataset:
133
- return "❌ GDPVAL dataset not available"
134
-
135
- try:
136
- # Simple keyword search (can be enhanced with embeddings)
137
- results = []
138
- query_lower = query.lower()
139
-
140
- for i, entry in enumerate(self.gdpval_dataset):
141
- if i >= 100: # Limit search for performance
142
- break
143
-
144
- # Check if query keywords appear in entry
145
- entry_text = str(entry).lower()
146
- if any(word in entry_text for word in query_lower.split()):
147
- results.append(entry)
148
- if len(results) >= limit:
149
- break
150
-
151
- if results:
152
- formatted = "### 📚 GDPVAL Knowledge Base Results:\n\n"
153
- for i, result in enumerate(results, 1):
154
- formatted += f"**Result {i}:**\n{result}\n\n"
155
- return formatted
156
- else:
157
- return "No relevant results found in GDPVAL dataset."
158
- except Exception as e:
159
- return f"❌ GDPVAL search error: {str(e)}"
160
-
161
- def analyze_legal_document(self, image_path: str) -> str:
162
- """
163
- Complete document analysis using multiple AI models:
164
- 1. DeepSeek-OCR for text extraction
165
- 2. ERNIE-4.5-VL for visual understanding
166
- 3. Legal analysis with AI
167
- """
168
- analysis = "## 📄 Complete Legal Document Analysis\n\n"
169
-
170
- # Step 1: OCR Text Extraction
171
- analysis += "### Step 1: Text Extraction (DeepSeek-OCR)\n"
172
- extracted_text = self.process_with_ocr(image_path)
173
- analysis += f"```\n{extracted_text[:500]}...\n```\n\n"
174
-
175
- # Step 2: Vision Analysis
176
- analysis += "### Step 2: Visual Document Understanding (ERNIE-4.5-VL)\n"
177
- vision_result = self.process_with_vision(
178
- image_path,
179
- "Analyze this legal document. Identify document type, key sections, and any notable elements."
180
- )
181
- analysis += f"{vision_result}\n\n"
182
-
183
- # Step 3: Legal Term Detection
184
- analysis += "### Step 3: Legal Analysis\n"
185
- legal_terms = self._detect_legal_terms(extracted_text)
186
- analysis += f"**Legal Terms Found:** {legal_terms}\n\n"
187
-
188
- # Step 4: Document Quality Check
189
- analysis += "### Step 4: Document Quality\n"
190
- quality = self._assess_document_quality(extracted_text)
191
- analysis += f"{quality}\n\n"
192
-
193
- return analysis
194
-
195
- def _detect_legal_terms(self, text: str) -> str:
196
- """Detect legal terminology in text"""
197
- legal_terms = [
198
- 'contract', 'agreement', 'party', 'clause', 'provision',
199
- 'whereas', 'hereby', 'herein', 'pursuant', 'consideration',
200
- 'liability', 'indemnify', 'warranty', 'breach', 'terminate',
201
- 'arbitration', 'jurisdiction', 'statute', 'regulation'
202
- ]
203
-
204
- found = [term for term in legal_terms if term.lower() in text.lower()]
205
- return ', '.join(found) if found else "None detected"
206
-
207
- def _assess_document_quality(self, text: str) -> str:
208
- """Assess document completeness and quality"""
209
- issues = []
210
-
211
- if len(text) < 100:
212
- issues.append("⚠️ Document seems very short")
213
-
214
- if not any(term in text.lower() for term in ['party', 'parties', 'agreement']):
215
- issues.append("⚠️ Missing party identification")
216
-
217
- if not any(term in text.lower() for term in ['date', 'dated', 'effective']):
218
- issues.append("⚠️ No effective date found")
219
-
220
- if issues:
221
- return "**Issues Found:**\n" + "\n".join(issues)
222
- else:
223
- return "✅ Document appears complete"
224
-
225
- def generate_with_minimax(self, messages: list) -> str:
226
- """Generate response using MiniMax-M2"""
227
- if not self.minimax_pipeline:
228
- return "❌ MiniMax-M2 not available"
229
-
230
- try:
231
- result = self.minimax_pipeline(messages)
232
- return result[0]['generated_text'] if result else "No response"
233
- except Exception as e:
234
- return f"❌ MiniMax error: {str(e)}"
235
-
236
- def get_mode_system_prompt(self, mode: str) -> str:
237
- """Get specialized system prompt based on mode"""
238
- prompts = {
239
- "navigation": """You are a ProVerBs Application Navigation Guide.
240
-
241
- **Enhanced Features:**
242
- - Document Analysis with OCR (DeepSeek-OCR)
243
- - Vision AI Analysis (ERNIE-4.5-VL)
244
- - Legal Knowledge Base (OpenAI GDPVAL)
245
- - 7 Specialized AI Modes
246
-
247
- Guide users to the right features.""",
248
-
249
- "general": """You are a General Legal Assistant for ProVerBs Legal AI Platform.
250
-
251
- **Available Tools:**
252
- - GDPVAL legal knowledge dataset
253
- - Vision AI for document understanding
254
- - OCR for text extraction
255
-
256
- Provide accurate legal information while noting you cannot provide legal advice.""",
257
-
258
- "document_validation": """You are an Advanced Document Validator.
259
-
260
- **AI-Powered Capabilities:**
261
- - **DeepSeek-OCR**: Extract text from scanned documents
262
- - **ERNIE-4.5-VL**: Understand document structure and layout visually
263
- - **Legal Analysis**: Validate completeness and legal terms
264
-
265
- **Process:**
266
- 1. Extract text with OCR
267
- 2. Analyze visually with ERNIE
268
- 3. Check legal validity
269
- 4. Provide detailed feedback""",
270
-
271
- "legal_research": """You are a Legal Research Assistant with GDPVAL access.
272
-
273
- **Enhanced Research Tools:**
274
- - OpenAI GDPVAL dataset for legal knowledge
275
- - Case law and precedent search
276
- - Statute and regulation analysis
277
-
278
- Provide comprehensive research with citations.""",
279
-
280
- "etymology": """You are a Legal Etymology Expert. Explain origins of legal terms.""",
281
-
282
- "case_management": """You are a Case Management Helper with AI document processing.""",
283
-
284
- "regulatory_updates": """You are a Regulatory Update Monitor."""
285
- }
286
- return prompts.get(mode, prompts["general"])
287
-
288
- def respond_with_mode(
289
- message,
290
- history: list,
291
- mode: str,
292
- model_choice: str,
293
- max_tokens: int,
294
- temperature: float,
295
- top_p: float,
296
- ):
297
- """Generate AI response based on selected mode"""
298
- chatbot = EnhancedAILegalChatbot()
299
-
300
- system_message = chatbot.get_mode_system_prompt(mode)
301
-
302
- # Enhanced responses for specific modes
303
- if mode == "document_validation" and "analyze" in message.lower():
304
- yield """
305
- ## 📄 Advanced Document Validator
306
-
307
- **Multi-AI Analysis Available:**
308
-
309
- 1. **DeepSeek-OCR**: Extract text from scanned documents
310
- 2. **ERNIE-4.5-VL**: Understand document structure visually
311
- 3. **Legal AI**: Validate and analyze content
312
-
313
- **Upload a document to get:**
314
- - ✅ Text extraction
315
- - Visual structure analysis
316
- - ✅ Legal term detection
317
- - Completeness check
318
- - ✅ Quality assessment
319
- """
320
- return
321
-
322
- if mode == "legal_research" and "search" in message.lower():
323
- # Search GDPVAL dataset
324
- gdpval_results = chatbot.search_gdpval(message)
325
- yield gdpval_results
326
- return
327
-
328
- # Choose AI model based on selection
329
- if model_choice == "MiniMax-M2" and chatbot.minimax_pipeline:
330
- # Use MiniMax-M2
331
- try:
332
- messages_minimax = [
333
- {"role": "system", "content": system_message},
334
- {"role": "user", "content": message}
335
- ]
336
- response = chatbot.generate_with_minimax(messages_minimax)
337
- yield response
338
- except Exception as e:
339
- yield f"MiniMax Error: {str(e)}"
340
- else:
341
- # Use HF Inference API (Llama) as default
342
- try:
343
- client = InferenceClient(model="meta-llama/Llama-3.3-70B-Instruct")
344
-
345
- messages = [{"role": "system", "content": system_message}]
346
-
347
- for user_msg, assistant_msg in history:
348
- if user_msg:
349
- messages.append({"role": "user", "content": user_msg})
350
- if assistant_msg:
351
- messages.append({"role": "assistant", "content": assistant_msg})
352
-
353
- messages.append({"role": "user", "content": message})
354
-
355
- response = ""
356
- for message_chunk in client.chat_completion(
357
- messages,
358
- max_tokens=max_tokens,
359
- stream=True,
360
- temperature=temperature,
361
- top_p=top_p,
362
- ):
363
- if message_chunk.choices and message_chunk.choices[0].delta.content:
364
- token = message_chunk.choices[0].delta.content
365
- response += token
366
- yield response
367
- except Exception as e:
368
- # Provide demo response for local preview
369
- demo_response = f"""
370
- ## 🎯 Preview Mode Response
371
-
372
- **Your Question:** {message}
373
-
374
- **Mode:** {mode}
375
-
376
- **Note:** This is a demo response for local preview. The AI chat will work fully once deployed to Hugging Face Spaces with authentication.
377
-
378
- ### What This Mode Does:
379
-
380
- {system_message[:200]}...
381
-
382
- ### Features Available:
383
- - UI and navigation fully functional
384
- - All tabs working
385
- - Watermark backgrounds active
386
- - Logo rotation active
387
- - ⚠️ AI responses require HF deployment
388
-
389
- **To test AI chat:** Deploy to Hugging Face Spaces where authentication is automatic.
390
-
391
- ---
392
-
393
- **For now:** Test the visual design, tab navigation, dropdowns, and timing features!
394
- """
395
- yield demo_response
396
-
397
-
398
- # Custom CSS with watermark background logos
399
- custom_css = """
400
- .gradio-container {
401
- max-width: 1200px !important;
402
- position: relative;
403
- }
404
-
405
- /* Watermark background container */
406
- .watermark-container {
407
- position: fixed;
408
- top: 0;
409
- left: 0;
410
- width: 100%;
411
- height: 100%;
412
- z-index: 0;
413
- pointer-events: none;
414
- overflow: hidden;
415
- }
416
-
417
- /* Watermark logo styling */
418
- .watermark-logo {
419
- position: absolute;
420
- width: 300px;
421
- height: 300px;
422
- opacity: 0.08;
423
- object-fit: contain;
424
- transition: opacity 2s ease-in-out;
425
- }
426
-
427
- .watermark-logo.active {
428
- opacity: 0.08;
429
- }
430
-
431
- .watermark-logo.hidden {
432
- opacity: 0;
433
- }
434
-
435
- /* Position watermarks at different locations */
436
- .watermark-1 {
437
- top: 10%;
438
- left: 10%;
439
- transform: rotate(-15deg);
440
- }
441
-
442
- .watermark-2 {
443
- top: 15%;
444
- right: 15%;
445
- transform: rotate(20deg);
446
- }
447
-
448
- .watermark-3 {
449
- bottom: 20%;
450
- left: 15%;
451
- transform: rotate(10deg);
452
- }
453
-
454
- .watermark-4 {
455
- bottom: 15%;
456
- right: 10%;
457
- transform: rotate(-20deg);
458
- }
459
-
460
- .watermark-5 {
461
- top: 50%;
462
- left: 50%;
463
- transform: translate(-50%, -50%) rotate(-5deg);
464
- }
465
-
466
- /* Ensure content is above watermarks */
467
- .gradio-container > * {
468
- position: relative;
469
- z-index: 1;
470
- }
471
-
472
- .header-section {
473
- text-align: center;
474
- padding: 40px 20px;
475
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
476
- color: white;
477
- border-radius: 12px;
478
- margin-bottom: 30px;
479
- position: relative;
480
- z-index: 2;
481
- }
482
-
483
- .logo-container {
484
- margin-bottom: 20px;
485
- display: flex;
486
- justify-content: center;
487
- align-items: center;
488
- }
489
-
490
- .rotating-logo {
491
- width: 150px;
492
- height: 150px;
493
- border-radius: 50%;
494
- object-fit: cover;
495
- border: 4px solid rgba(255, 255, 255, 0.8);
496
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
497
- }
498
-
499
- .header-section h1 {
500
- font-size: 3rem;
501
- margin-bottom: 10px;
502
- font-weight: 700;
503
- text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
504
- }
505
-
506
- /* Make sure tabs and content are above watermarks */
507
- .tabs, .tabitem {
508
- position: relative;
509
- z-index: 1;
510
- }
511
- """
512
-
513
- # JavaScript for rotating logos in header and random watermarks
514
- rotating_logo_js = """
515
- <script>
516
- // Header logo rotation
517
- function rotateHeaderLogo() {
518
- const logos = document.querySelectorAll('.rotating-logo');
519
- let currentIndex = 0;
520
-
521
- function showNextLogo() {
522
- logos.forEach((logo, index) => {
523
- logo.style.display = 'none';
524
- });
525
- if (logos.length > 0) {
526
- logos[currentIndex].style.display = 'block';
527
- currentIndex = (currentIndex + 1) % logos.length;
528
- }
529
- }
530
-
531
- showNextLogo();
532
- setInterval(showNextLogo, 60000);
533
- }
534
-
535
- // Random watermark rotation
536
- function rotateWatermarks() {
537
- const watermarks = document.querySelectorAll('.watermark-logo');
538
- const logoImages = [
539
- 'file/assets/logo_1.jpg',
540
- 'file/assets/logo_2.jpg',
541
- 'file/assets/logo_3.jpg'
542
- ];
543
-
544
- function randomizeWatermarks() {
545
- watermarks.forEach((watermark) => {
546
- // Fade out
547
- watermark.classList.remove('active');
548
- watermark.classList.add('hidden');
549
-
550
- setTimeout(() => {
551
- // Pick random logo
552
- const randomLogo = logoImages[Math.floor(Math.random() * logoImages.length)];
553
- watermark.src = randomLogo;
554
-
555
- // Fade in
556
- watermark.classList.remove('hidden');
557
- watermark.classList.add('active');
558
- }, 2000);
559
- });
560
- }
561
-
562
- // Initial randomization
563
- randomizeWatermarks();
564
-
565
- // Change watermarks every 30 seconds with random logos
566
- setInterval(randomizeWatermarks, 30000);
567
- }
568
-
569
- // Initialize both rotations
570
- if (document.readyState === 'loading') {
571
- document.addEventListener('DOMContentLoaded', function() {
572
- rotateHeaderLogo();
573
- rotateWatermarks();
574
- });
575
- } else {
576
- rotateHeaderLogo();
577
- rotateWatermarks();
578
- }
579
- </script>
580
- """
581
-
582
- # Create the main application
583
- demo = gr.Blocks(title="ProVerBs Legal AI Platform")
584
-
585
- with demo:
586
-
587
- # Watermark background logos
588
- gr.HTML(f"""
589
- <div class="watermark-container">
590
- <img src="file/assets/logo_1.jpg" class="watermark-logo watermark-1 active" alt="Watermark 1">
591
- <img src="file/assets/logo_2.jpg" class="watermark-logo watermark-2 active" alt="Watermark 2">
592
- <img src="file/assets/logo_3.jpg" class="watermark-logo watermark-3 active" alt="Watermark 3">
593
- <img src="file/assets/logo_1.jpg" class="watermark-logo watermark-4 active" alt="Watermark 4">
594
- <img src="file/assets/logo_2.jpg" class="watermark-logo watermark-5 active" alt="Watermark 5">
595
- </div>
596
-
597
- <style>{custom_css}</style>
598
- {rotating_logo_js}
599
-
600
- <!-- Header with Rotating Logos -->
601
- <div class="header-section">
602
- <div class="logo-container">
603
- <img src="file/assets/logo_1.jpg" class="rotating-logo" alt="Logo 1" style="display: block;">
604
- <img src="file/assets/logo_2.jpg" class="rotating-logo" alt="Logo 2" style="display: none;">
605
- <img src="file/assets/logo_3.jpg" class="rotating-logo" alt="Logo 3" style="display: none;">
606
- </div>
607
- <h1>⚖️ ProVerBs Legal AI Platform</h1>
608
- <p>Lawful vs. Legal: Dual Analysis "Adappt'plication"</p>
609
- <p style="font-size: 1rem; margin-top: 10px;">
610
- Multi-AI Legal System | 5 AI Models Working Together 🚀
611
- </p>
612
- </div>
613
- """)
614
-
615
- gr.Markdown("---")
616
-
617
- # Main Tabs
618
- with gr.Tabs():
619
-
620
- # Tab 1: Welcome
621
- with gr.Tab("🏠 Welcome"):
622
- gr.Markdown("""
623
- ## Welcome to ProVerBs Legal AI Platform
624
-
625
- ### 🤖 5 AI Models Integrated:
626
-
627
- 1. **DeepSeek-OCR** - Extract text from scanned documents
628
- 2. **ERNIE-4.5-VL** - Advanced vision-language understanding
629
- 3. **OpenAI GDPVAL** - Legal knowledge dataset
630
- 4. **Meta Llama 3.3** - General AI assistance
631
- 5. **MiniMax-M2** - Advanced text generation
632
-
633
- ### ⚖️ 7 Specialized Modes:
634
-
635
- - 📍 Navigation Guide
636
- - 💬 General Legal Assistant (with GDPVAL)
637
- - 📄 Document Validator (OCR + Vision AI)
638
- - 🔍 Legal Research (GDPVAL-powered)
639
- - 📚 Etymology Expert
640
- - 💼 Case Management
641
- - 📋 Regulatory Updates
642
-
643
- ### ✨ Unique Features:
644
-
645
- - **Multi-AI Document Analysis**: Combines OCR + Vision AI
646
- - **Legal Knowledge Base**: Access to GDPVAL dataset
647
- - **Rotating Custom Logos**: Your professional branding
648
- - **Complete Legal Solution**: All-in-one platform
649
- """)
650
-
651
- # Tab 2: AI Legal Chatbot
652
- with gr.Tab("🤖 AI Legal Chatbot"):
653
- gr.Markdown("""
654
- ## Multi-AI Legal Chatbot
655
-
656
- **Powered by 5 AI Models** for comprehensive legal assistance!
657
-
658
- **Choose Your AI Model:**
659
- - **Meta Llama 3.3** - Fast, efficient, streaming responses
660
- - **MiniMax-M2** - Advanced text generation capabilities
661
- """)
662
-
663
- mode_selector = gr.Dropdown(
664
- choices=[
665
- "navigation",
666
- "general",
667
- "document_validation",
668
- "legal_research",
669
- "etymology",
670
- "case_management",
671
- "regulatory_updates"
672
- ],
673
- value="navigation",
674
- label="Select AI Assistant Mode"
675
- )
676
-
677
- model_selector = gr.Dropdown(
678
- choices=[
679
- "Meta Llama 3.3",
680
- "MiniMax-M2"
681
- ],
682
- value="Meta Llama 3.3",
683
- label="Select AI Model"
684
- )
685
-
686
- gr.Markdown("---")
687
-
688
- chatbot = gr.ChatInterface(
689
- respond_with_mode,
690
- chatbot=gr.Chatbot(height=500),
691
- additional_inputs=[
692
- mode_selector,
693
- model_selector,
694
- gr.Slider(128, 4096, value=2048, label="Max Tokens"),
695
- gr.Slider(0.1, 2.0, value=0.7, label="Temperature"),
696
- gr.Slider(0.1, 1.0, value=0.95, label="Top-p"),
697
- ],
698
- examples=[
699
- ["How do I use the multi-AI document analysis?"],
700
- ["Search GDPVAL for contract law information"],
701
- ["Analyze a document with vision AI"],
702
- ],
703
- )
704
-
705
- # Tab 3: Document Analysis (NEW!)
706
- with gr.Tab("📄 Document Analysis"):
707
- gr.Markdown("""
708
- ## 📄 Document Upload & AI Analysis
709
-
710
- Upload legal documents for comprehensive AI analysis!
711
- """)
712
-
713
- with gr.Row():
714
- with gr.Column(scale=1):
715
- doc_upload = gr.File(
716
- label="📎 Upload Document",
717
- file_types=[".pdf", ".jpg", ".jpeg", ".png", ".txt"]
718
- )
719
-
720
- analysis_type = gr.Radio(
721
- choices=[
722
- "Complete Analysis",
723
- "OCR Only",
724
- "Visual Only",
725
- "Legal Validation"
726
- ],
727
- value="Complete Analysis",
728
- label="Analysis Type"
729
- )
730
-
731
- analyze_btn = gr.Button("🔍 Analyze", variant="primary", size="lg")
732
-
733
- with gr.Column(scale=2):
734
- analysis_output = gr.Markdown("Upload a document to begin analysis.")
735
-
736
- def analyze_doc(file_path, analysis_type):
737
- if not file_path:
738
- return "⚠️ Please upload a document first."
739
-
740
- filename = file_path.split('/')[-1] if '/' in file_path else file_path.split('\\')[-1]
741
-
742
- return f"""
743
- ## 📄 Document Analysis Results
744
-
745
- **File:** {filename}
746
- **Analysis Type:** {analysis_type}
747
-
748
- ### ⚠️ Preview Mode
749
-
750
- **What happens in production:**
751
- - **DeepSeek-OCR** extracts text from images
752
- - **ERNIE-4.5-VL** analyzes document structure
753
- - **Legal AI** validates completeness
754
-
755
- **Demo Output:**
756
- - Document uploaded successfully ✅
757
- - File format supported ✅
758
- - Ready for AI analysis ✅
759
-
760
- **Note:** Full analysis available after HF deployment.
761
-
762
- **Try it:** Upload any legal document (PDF, image, text) to see the interface!
763
- """
764
-
765
- analyze_btn.click(
766
- fn=analyze_doc,
767
- inputs=[doc_upload, analysis_type],
768
- outputs=analysis_output
769
- )
770
-
771
- # Tab 4: Features
772
- with gr.Tab("✨ Features"):
773
- gr.Markdown("""
774
- ## Advanced AI Features
775
-
776
- ### 🤖 Integrated AI Models:
777
-
778
- 1. **DeepSeek-OCR**
779
- - Text extraction from images
780
- - Document scanning
781
- - High accuracy OCR
782
-
783
- 2. **ERNIE-4.5-VL** (Baidu)
784
- - Vision-language understanding
785
- - Document layout analysis
786
- - Visual question answering
787
-
788
- 3. **OpenAI GDPVAL**
789
- - Legal knowledge dataset
790
- - Case law and precedents
791
- - Regulatory information
792
-
793
- 4. **Meta Llama 3.3**
794
- - General AI assistance
795
- - Legal reasoning
796
- - Natural conversation
797
-
798
- 5. **MiniMax-M2** ⭐ NEW!
799
- - Advanced text generation
800
- - High-quality responses
801
- - Alternative AI model option
802
-
803
- ### 🎯 What This Means:
804
-
805
- - **Most Advanced**: 5 AI models working together
806
- - **Best Analysis**: Multiple AI perspectives
807
- - **Model Choice**: Select the best AI for your task
808
- - **Comprehensive**: Text + Vision + Knowledge
809
- - **Professional**: Your custom branding with logos
810
- """)
811
-
812
- # Tab 4: About
813
- with gr.Tab("ℹ️ About"):
814
- gr.Markdown("""
815
- ## About ProVerBs Legal AI - Complete Edition
816
-
817
- ### 🚀 Version 2.1.0 - Complete Multi-AI Integration
818
-
819
- **This is the most advanced version** with all AI capabilities:
820
-
821
- - ✅ 7 Specialized AI Modes
822
- - ✅ 3 Rotating Custom Logos
823
- - ✅ DeepSeek-OCR Integration
824
- - ✅ ERNIE-4.5-VL Vision AI
825
- - ✅ OpenAI GDPVAL Dataset
826
- - ✅ Meta Llama 3.3 AI
827
- - ✅ MiniMax-M2 AI ⭐ NEW!
828
-
829
- ### 📊 Technical Stack:
830
-
831
- - **Frontend**: Gradio 4.x
832
- - **OCR**: DeepSeek-OCR
833
- - **Vision**: ERNIE-4.5-VL-28B
834
- - **Dataset**: OpenAI GDPVAL
835
- - **LLM 1**: Meta Llama 3.3-70B
836
- - **LLM 2**: MiniMax-M2
837
- - **Platform**: Hugging Face Spaces
838
-
839
- ### ⚠️ Disclaimer:
840
-
841
- This platform provides general legal information only.
842
- Always consult with a qualified attorney for specific legal matters.
843
-
844
- ---
845
-
846
- **Version 2.1.0** | Built by Solomon7890 | 5-Model AI Legal Platform
847
- """)
848
-
849
- # Footer
850
- gr.Markdown("""
851
- ---
852
- <div style="text-align: center; padding: 20px;">
853
- <p><strong>⚖️ ProVerBs Legal AI Platform</strong> | Version 2.1.0 - 5-Model AI Edition</p>
854
- <p>Powered by: DeepSeek-OCR • ERNIE-4.5-VL • GDPVAL • Llama 3.3 • MiniMax-M2</p>
855
- <p>© 2024 ProVerBs Legal AI</p>
856
- </div>
857
- """)
858
-
859
- if __name__ == "__main__":
860
- demo.queue(max_size=20)
861
- demo.launch(
862
- server_name="0.0.0.0",
863
- server_port=7860,
864
- share=False,
865
- show_error=True
866
- )
 
1
+ """
2
+ ProVerBs Legal AI - Integrated Landing Page with Rotating Logos
3
+ Features your custom logos with 60-second rotation
4
+ """
5
+
6
+ import gradio as gr
7
+ from huggingface_hub import InferenceClient
8
+ import json
9
+ import os
10
+ from datetime import datetime
11
+ from typing import Dict, List, Optional
12
+ import base64
13
+ from pathlib import Path
14
+
15
+ class AILegalChatbotIntegration:
16
+ """
17
+ Integration of your AI Legal Chatbot into Gradio
18
+ Supports all specialized modes from your original chatbot
19
+ """
20
+
21
+ def __init__(self):
22
+ self.specialized_modes = {
23
+ "navigation": "Application Navigation Guide",
24
+ "general": "General Legal Assistant",
25
+ "document_validation": "Document Validator",
26
+ "legal_research": "Legal Research Assistant",
27
+ "etymology": "Legal Etymology Lookup",
28
+ "case_management": "Case Management Helper",
29
+ "regulatory_updates": "Regulatory Update Monitor"
30
+ }
31
+
32
+ def get_mode_system_prompt(self, mode: str) -> str:
33
+ """Get specialized system prompt based on mode"""
34
+ prompts = {
35
+ "navigation": """You are a ProVerBs Application Navigation Guide. Help users navigate the application's features:
36
+
37
+ **Available Features:**
38
+ - Legal Action Advisor: Get recommendations for seeking justice
39
+ - Document Analysis: Upload and analyze legal documents
40
+ - Legal Research: Access comprehensive legal databases
41
+ - Communications: SMS, email, and phone integration
42
+ - Document Generation: Create legal documents with AI
43
+
44
+ Guide users to the right features and explain how to use them effectively.""",
45
+
46
+ "general": """You are a General Legal Assistant for ProVerBs Legal AI Platform. Provide accurate legal 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.""",
47
+
48
+ "document_validation": """You are a Document Validator. Analyze legal documents for:
49
+ - Completeness and required elements
50
+ - Legal terminology accuracy
51
+ - Structural integrity
52
+ - Common issues and red flags
53
+ Provide specific feedback on document quality and validity.""",
54
+
55
+ "legal_research": """You are a Legal Research Assistant. Help users:
56
+ - Find relevant case law and precedents
57
+ - Understand statutes and regulations
58
+ - Research legal principles and concepts
59
+ - Cite authoritative legal sources
60
+ Provide comprehensive research guidance.""",
61
+
62
+ "etymology": """You are a Legal Etymology Expert. Explain the origins and meanings of legal terms:
63
+ - Latin and historical roots
64
+ - Evolution of legal terminology
65
+ - Modern usage and interpretation
66
+ - Related legal concepts
67
+ Make legal language accessible and understandable.""",
68
+
69
+ "case_management": """You are a Case Management Helper. Assist with:
70
+ - Organizing case information
71
+ - Tracking deadlines and milestones
72
+ - Managing documents and evidence
73
+ - Coordinating case activities
74
+ Provide practical case management advice.""",
75
+
76
+ "regulatory_updates": """You are a Regulatory Update Monitor. Keep users informed about:
77
+ - Recent legal and regulatory changes
78
+ - Industry-specific compliance updates
79
+ - Important legislative developments
80
+ - Impact analysis of new regulations
81
+ Provide timely and relevant regulatory information."""
82
+ }
83
+ return prompts.get(mode, prompts["general"])
84
+
85
+ def format_navigation_response(self, query: str) -> str:
86
+ """Format response for navigation queries"""
87
+ query_lower = query.lower()
88
+
89
+ recommendations = []
90
+
91
+ if any(word in query_lower for word in ["document", "contract", "agreement", "analyze"]):
92
+ recommendations.append("📄 **Document Analysis** - Upload and analyze your documents")
93
+
94
+ if any(word in query_lower for word in ["research", "case", "law", "statute"]):
95
+ recommendations.append("🔍 **Legal Research** - Access comprehensive legal databases")
96
+
97
+ if any(word in query_lower for word in ["action", "remedy", "justice", "sue"]):
98
+ recommendations.append("⚖️ **Legal Action Advisor** - Get recommendations for your situation")
99
+
100
+ if any(word in query_lower for word in ["create", "generate", "template", "form"]):
101
+ recommendations.append("📝 **Document Generation** - Create legal documents with AI")
102
+
103
+ if any(word in query_lower for word in ["communicate", "message", "sms", "email"]):
104
+ recommendations.append("📧 **Communications** - Integrated messaging system")
105
+
106
+ if recommendations:
107
+ return "### I can help you with these features:\n\n" + "\n".join(recommendations) + "\n\n**What would you like to explore?**"
108
+
109
+ return None
110
+
111
+ def respond_with_mode(
112
+ message,
113
+ history: list,
114
+ mode: str,
115
+ max_tokens: int,
116
+ temperature: float,
117
+ top_p: float,
118
+ hf_token: gr.OAuthToken | None = None
119
+ ):
120
+ """Generate AI response based on selected mode"""
121
+ chatbot_integration = AILegalChatbotIntegration()
122
+
123
+ system_message = chatbot_integration.get_mode_system_prompt(mode)
124
+
125
+ if mode == "navigation":
126
+ nav_response = chatbot_integration.format_navigation_response(message)
127
+ if nav_response:
128
+ yield nav_response
129
+ return
130
+
131
+ token = hf_token.token if hf_token else None
132
+ client = InferenceClient(token=token, model="meta-llama/Llama-3.3-70B-Instruct")
133
+
134
+ messages = [{"role": "system", "content": system_message}]
135
+
136
+ for user_msg, assistant_msg in history:
137
+ if user_msg:
138
+ messages.append({"role": "user", "content": user_msg})
139
+ if assistant_msg:
140
+ messages.append({"role": "assistant", "content": assistant_msg})
141
+
142
+ messages.append({"role": "user", "content": message})
143
+
144
+ response = ""
145
+ try:
146
+ for message_chunk in client.chat_completion(
147
+ messages,
148
+ max_tokens=max_tokens,
149
+ stream=True,
150
+ temperature=temperature,
151
+ top_p=top_p,
152
+ ):
153
+ if message_chunk.choices and message_chunk.choices[0].delta.content:
154
+ token = message_chunk.choices[0].delta.content
155
+ response += token
156
+ yield response
157
+ except Exception as e:
158
+ yield f"Error: {str(e)}"
159
+
160
+
161
+ # Custom CSS with rotating logo animation
162
+ custom_css = """
163
+ .gradio-container {
164
+ max-width: 1200px !important;
165
+ }
166
+
167
+ .header-section {
168
+ text-align: center;
169
+ padding: 40px 20px;
170
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
171
+ color: white;
172
+ border-radius: 12px;
173
+ margin-bottom: 30px;
174
+ position: relative;
175
+ }
176
+
177
+ .logo-container {
178
+ margin-bottom: 20px;
179
+ display: flex;
180
+ justify-content: center;
181
+ align-items: center;
182
+ }
183
+
184
+ .rotating-logo {
185
+ width: 150px;
186
+ height: 150px;
187
+ border-radius: 50%;
188
+ object-fit: cover;
189
+ border: 4px solid rgba(255, 255, 255, 0.8);
190
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
191
+ animation: fadeInOut 60s infinite;
192
+ }
193
+
194
+ @keyframes fadeInOut {
195
+ 0%, 20% { opacity: 1; }
196
+ 25%, 45% { opacity: 0; }
197
+ 50%, 70% { opacity: 1; }
198
+ 75%, 95% { opacity: 0; }
199
+ 100% { opacity: 1; }
200
+ }
201
+
202
+ .logo-1 { animation-delay: 0s; }
203
+ .logo-2 { animation-delay: 20s; }
204
+ .logo-3 { animation-delay: 40s; }
205
+
206
+ .header-section h1 {
207
+ font-size: 3rem;
208
+ margin-bottom: 10px;
209
+ font-weight: 700;
210
+ text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
211
+ }
212
+
213
+ .mode-selector {
214
+ font-size: 1.1rem !important;
215
+ font-weight: 600 !important;
216
+ padding: 12px !important;
217
+ }
218
+
219
+ .tab-nav button {
220
+ font-size: 16px;
221
+ font-weight: 600;
222
+ }
223
+
224
+ .feature-card {
225
+ border: 2px solid #e0e0e0;
226
+ border-radius: 12px;
227
+ padding: 20px;
228
+ margin: 10px;
229
+ background: #f8f9fa;
230
+ transition: all 0.3s;
231
+ }
232
+
233
+ .feature-card:hover {
234
+ border-color: #667eea;
235
+ box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
236
+ transform: translateY(-2px);
237
+ }
238
+ """
239
+
240
+ # JavaScript for rotating logos
241
+ rotating_logo_js = """
242
+ <script>
243
+ function rotateLogo() {
244
+ const logos = document.querySelectorAll('.rotating-logo');
245
+ let currentIndex = 0;
246
+
247
+ function showNextLogo() {
248
+ logos.forEach((logo, index) => {
249
+ logo.style.display = 'none';
250
+ });
251
+
252
+ logos[currentIndex].style.display = 'block';
253
+
254
+ currentIndex = (currentIndex + 1) % logos.length;
255
+ }
256
+
257
+ // Show first logo initially
258
+ showNextLogo();
259
+
260
+ // Rotate every 60 seconds
261
+ setInterval(showNextLogo, 60000);
262
+ }
263
+
264
+ // Start rotation when page loads
265
+ if (document.readyState === 'loading') {
266
+ document.addEventListener('DOMContentLoaded', rotateLogo);
267
+ } else {
268
+ rotateLogo();
269
+ }
270
+ </script>
271
+ """
272
+
273
+ # Create the main application
274
+ demo = gr.Blocks(title="ProVerBs Legal AI Platform")
275
+ demo.css = custom_css
276
+
277
+ with demo:
278
+
279
+ # Header with Rotating Logos
280
+ gr.HTML(f"""
281
+ <div class="header-section">
282
+ <div class="logo-container">
283
+ <img src="file/assets/logo_1.jpg" class="rotating-logo logo-1" alt="ProVerBs Logo 1" style="display: block;">
284
+ <img src="file/assets/logo_2.jpg" class="rotating-logo logo-2" alt="ProVerBs Logo 2" style="display: none;">
285
+ <img src="file/assets/logo_3.jpg" class="rotating-logo logo-3" alt="ProVerBs Logo 3" style="display: none;">
286
+ </div>
287
+ <h1>⚖️ ProVerBs Legal AI Platform</h1>
288
+ <p>Lawful vs. Legal: Dual Analysis "Adappt'plication"</p>
289
+ <p style="font-size: 1rem; margin-top: 10px;">
290
+ Professional Legal AI System | Multi-Module Platform | Powered by Advanced AI
291
+ </p>
292
+ </div>
293
+ {rotating_logo_js}
294
+ """)
295
+
296
+ # Login Section (commented out for local preview)
297
+ # with gr.Row():
298
+ # with gr.Column(scale=1):
299
+ # gr.LoginButton(size="lg")
300
+ # with gr.Column(scale=5):
301
+ # gr.Markdown("👈 **Login with your Hugging Face account** for full access")
302
+
303
+ gr.Markdown("---")
304
+
305
+ # Main Tabs
306
+ with gr.Tabs() as tabs:
307
+
308
+ # Tab 1: Welcome
309
+ with gr.Tab("🏠 Welcome", id="welcome"):
310
+ gr.Markdown("""
311
+ ## Welcome to ProVerBs Legal AI Platform
312
+
313
+ A comprehensive legal AI system with **multiple specialized assistants** to help you navigate legal matters.
314
+
315
+ ### 🎯 Choose Your AI Assistant Mode
316
+
317
+ Our platform features **7 specialized AI modes** to serve your specific needs:
318
+
319
+ - **📍 Navigation Guide** - Help finding features in the platform
320
+ - **💬 General Legal Assistant** - Broad legal questions and guidance
321
+ - **📄 Document Validator** - Analyze and validate legal documents
322
+ - **🔍 Legal Research** - Case law and statutory research
323
+ - **📚 Etymology Expert** - Understanding legal terminology origins
324
+ - **💼 Case Management** - Organizing and tracking legal cases
325
+ - **📋 Regulatory Updates** - Stay informed about legal changes
326
+
327
+ ### ⚖️ Platform Features
328
+
329
+ - **Legal Action Advisor** - Get personalized recommendations
330
+ - **Document Analysis** - AI-powered document processing
331
+ - **Legal Research Tools** - Comprehensive databases
332
+ - **Communications** - Integrated SMS, email, phone
333
+ - **Document Generation** - Create legal documents with AI
334
+
335
+ **Ready to start?** Click the "AI Legal Chatbot" tab to begin!
336
+ """)
337
+
338
+ # Tab 2: AI Legal Chatbot
339
+ with gr.Tab("🤖 AI Legal Chatbot", id="chatbot"):
340
+ gr.Markdown("""
341
+ ## AI Legal Chatbot - Multiple Specialized Modes
342
+
343
+ Select your assistant mode below and start chatting!
344
+ """)
345
+
346
+ mode_selector = gr.Dropdown(
347
+ choices=list({
348
+ "navigation": "📍 Navigation Guide - Find features in the app",
349
+ "general": "💬 General Legal Assistant - Broad legal questions",
350
+ "document_validation": "📄 Document Validator - Analyze documents",
351
+ "legal_research": "🔍 Legal Research - Case law & statutes",
352
+ "etymology": "📚 Etymology Expert - Legal term origins",
353
+ "case_management": "💼 Case Management - Organize cases",
354
+ "regulatory_updates": "📋 Regulatory Updates - Legal changes"
355
+ }.items()),
356
+ value="navigation",
357
+ label="Select AI Assistant Mode",
358
+ elem_classes=["mode-selector"]
359
+ )
360
+
361
+ gr.Markdown("---")
362
+
363
+ chatbot = gr.ChatInterface(
364
+ lambda message, history, mode, max_tokens, temperature, top_p, hf_token:
365
+ respond_with_mode(message, history, mode.split(":")[0], max_tokens, temperature, top_p, hf_token),
366
+ chatbot=gr.Chatbot(
367
+ height=500,
368
+ placeholder="💬 Select a mode above and ask your question...",
369
+ show_label=False,
370
+ ),
371
+ textbox=gr.Textbox(
372
+ placeholder="Type your question here...",
373
+ container=False,
374
+ scale=7
375
+ ),
376
+ additional_inputs=[
377
+ mode_selector,
378
+ gr.Slider(128, 4096, value=2048, step=128, label="Max Tokens"),
379
+ gr.Slider(0.1, 2.0, value=0.7, step=0.1, label="Temperature"),
380
+ gr.Slider(0.1, 1.0, value=0.95, step=0.05, label="Top-p"),
381
+ ],
382
+ examples=[
383
+ ["How do I navigate to the document analysis feature?"],
384
+ ["What is the difference between lawful and legal?"],
385
+ ["Can you help me validate a contract?"],
386
+ ["I need to research case law about contracts"],
387
+ ["What does 'habeas corpus' mean?"],
388
+ ["How do I organize my legal case documents?"],
389
+ ["What are the latest regulatory changes in business law?"],
390
+ ],
391
+ cache_examples=False,
392
+ )
393
+
394
+ gr.Markdown("""
395
+ ### 💡 Tips for Best Results
396
+
397
+ - **Choose the right mode** for your question type
398
+ - **Be specific** with your questions
399
+ - **Navigation Mode** helps you find features in the app
400
+ - Each mode is specialized for different tasks!
401
+ """)
402
+
403
+ # Tab 3: Features Overview
404
+ with gr.Tab("✨ Features", id="features"):
405
+ gr.Markdown("""
406
+ ## Platform Features
407
+
408
+ ### 🎯 Core Capabilities
409
+ """)
410
+
411
+ with gr.Row():
412
+ with gr.Column():
413
+ gr.Markdown("""
414
+ <div class="feature-card">
415
+
416
+ #### ⚖️ Legal Action Advisor
417
+ Get personalized recommendations for seeking justice and remedy
418
+
419
+ - AI-powered action recommendations
420
+ - Case type analysis
421
+ - Timeline planning
422
+ - Free resource finder
423
+ - Evidence collection guidance
424
+ </div>
425
+ """)
426
+
427
+ with gr.Column():
428
+ gr.Markdown("""
429
+ <div class="feature-card">
430
+
431
+ #### 📄 Document Analysis
432
+ Upload and analyze legal documents with AI insights
433
+
434
+ - OCR text extraction
435
+ - Multi-format support (PDF, DOCX, TXT)
436
+ - AI-powered analysis
437
+ - Legal database cross-reference
438
+ - Document validation
439
+ </div>
440
+ """)
441
+
442
+ with gr.Row():
443
+ with gr.Column():
444
+ gr.Markdown("""
445
+ <div class="feature-card">
446
+
447
+ #### 🔍 Legal Research
448
+ Comprehensive legal research tools and databases
449
+
450
+ - Multiple legal databases
451
+ - Case law research
452
+ - Statutory analysis
453
+ - Historical documents
454
+ - Citation tools
455
+ </div>
456
+ """)
457
+
458
+ with gr.Column():
459
+ gr.Markdown("""
460
+ <div class="feature-card">
461
+
462
+ #### 📧 Communications
463
+ Integrated communication system
464
+
465
+ - Twilio integration
466
+ - SMS messaging
467
+ - Email notifications
468
+ - Phone capabilities
469
+ - Legal alerts & reminders
470
+ </div>
471
+ """)
472
+
473
+ # Tab 4: About
474
+ with gr.Tab("ℹ️ About", id="about"):
475
+ gr.Markdown("""
476
+ ## About ProVerBs Legal AI
477
+
478
+ ### 🎓 Our Platform
479
+
480
+ ProVerBs Legal AI combines advanced artificial intelligence with comprehensive legal knowledge
481
+ to provide accessible, accurate legal information and tools.
482
+
483
+ ### 🤖 Specialized AI Chatbot
484
+
485
+ Our AI chatbot features **7 specialized modes**, each trained for specific legal tasks.
486
+
487
+ ### 👥 Who We Serve
488
+
489
+ - **Legal Professionals** - Enhance your practice with AI
490
+ - **Law Students** - Research and study assistance
491
+ - **Businesses** - Understand legal implications
492
+ - **Individuals** - Learn about your legal rights
493
+
494
+ ### 🔒 Privacy & Security
495
+
496
+ - End-to-end encryption
497
+ - No storage without consent
498
+ - GDPR and CCPA compliant
499
+ - Secure OAuth authentication
500
+
501
+ ### ⚠️ Important Disclaimer
502
+
503
+ This platform provides general legal information only. It does not constitute legal advice.
504
+ Always consult with a qualified attorney for specific legal matters.
505
+
506
+ ---
507
+
508
+ **Version 1.0.0** | Built by Solomon7890 | Powered by Hugging Face
509
+ """)
510
+
511
+ # Footer
512
+ gr.Markdown("""
513
+ ---
514
+
515
+ <div style="text-align: center; padding: 20px; color: #666;">
516
+ <p><strong>⚖️ ProVerBs Legal AI Platform</strong> | Version 1.0.0</p>
517
+ <p>
518
+ <a href="https://huggingface.co/Solomon7890" target="_blank">Hugging Face</a> |
519
+ <a href="https://github.com/Solomon7890" target="_blank">GitHub</a>
520
+ </p>
521
+ <p style="font-size: 0.9rem; margin-top: 10px;">
522
+ ⚠️ <strong>Disclaimer</strong>: This AI provides general legal information only.
523
+ Consult with a licensed attorney for specific legal matters.
524
+ </p>
525
+ <p style="font-size: 0.85rem; color: #999;">
526
+ © 2024 ProVerBs Legal AI. Built with ❤️ for legal professionals worldwide.
527
+ </p>
528
+ </div>
529
+ """)
530
+
531
+ if __name__ == "__main__":
532
+ demo.queue(max_size=20)
533
+ demo.launch(
534
+ server_name="0.0.0.0",
535
+ server_port=7860,
536
+ share=False,
537
+ show_error=True
538
+ )