Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
|
@@ -6,5 +6,62 @@ colorTo: red
|
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
---
|
| 9 |
+
## ⚖️ LEX - Legal Expert Agentic System
|
| 10 |
+
LEX is an AI-powered legal analysis system designed to bridge the "Access to Justice Gap". It helps users navigate intimidating legal documents and proceedings by providing immediate clarity through a sophisticated multi-agent workflow.
|
| 11 |
+
+4
|
| 12 |
+
|
| 13 |
+
## 🏗️ System Architecture: Optimized Parallel Pipeline
|
| 14 |
+
LEX utilizes an AISA (Agentic Interactive System Architecture) workflow that runs 6 specialized agents across 4 logical phases. To ensure a professional and responsive user experience, the system employs Python's ThreadPoolExecutor to reduce processing time from ~20 seconds to just 10–12 seconds.
|
| 15 |
+
|
| 16 |
+
## 🚀 Setup & Installation
|
| 17 |
+
- Prerequisites
|
| 18 |
+
Python 3.9+
|
| 19 |
+
OpenAI API Key (Optimized for gpt-4o-mini)
|
| 20 |
+
Required Libraries: pydantic, faiss-cpu, sqlite3, concurrent.futures
|
| 21 |
+
|
| 22 |
+
- Installation
|
| 23 |
+
Clone the repository:
|
| 24 |
+
Bash: git clone https://huggingface.co/spaces/AISA-Framework/LEX-AdeemAlotaibi
|
| 25 |
+
cd LEX-AdeemAlotaibi
|
| 26 |
+
|
| 27 |
+
Install dependencies:
|
| 28 |
+
Bash: pip install -r requirements.txt
|
| 29 |
+
|
| 30 |
+
Configure Environment:
|
| 31 |
+
Set AISA_DETERMINISTIC=1 for reproducible test results
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
## 🛠️ Usage
|
| 36 |
+
|
| 37 |
+
LEX is designed to be intuitive for users facing legal stress.The system processes messy, real-world text and converts it into a structured legal analysis.
|
| 38 |
+
|
| 39 |
+
### 1. Inputting a Case
|
| 40 |
+
[cite_start]Users can input their legal situation in the text area (up to 8,000 characters).This can include:
|
| 41 |
+
* [cite_start]**Narratives:** Describing a dispute or situation in plain language.
|
| 42 |
+
* [cite_start]**Document Text:** Pasting the content of a termination notice, contract clause, or court judgment.
|
| 43 |
+
* [cite_start]**Multilingual Input:** Input can be in Arabic or English; the system is robust enough to categorize and analyze both.
|
| 44 |
+
|
| 45 |
+
### 2. The Analysis Process
|
| 46 |
+
[cite_start]Once submitted, the system triggers the **AISA Workflow**: [cite: 11]
|
| 47 |
+
* [cite_start]**Instant Identification:** The system immediately identifies the "Intent" (e.g., is this a notice, a contract, or a judgment?). [cite: 30, 32]
|
| 48 |
+
* [cite_start]**Plain Language Explanation:** It translates complex legal jargon into an easy-to-understand summary using the RAG tool. [cite: 33, 54]
|
| 49 |
+
* **Automated Quality Check:** The Critic Agent reviews the analysis. [cite_start]If it misses a key legal point (like a specific 90-day notice rule), it automatically re-runs the logic to ensure accuracy. [cite: 37, 49]
|
| 50 |
+
|
| 51 |
+
### 3. Understanding the Output
|
| 52 |
+
[cite_start]The user receives an **Analysis Report** containing: [cite: 71, 75]
|
| 53 |
+
* [cite_start]**Summary:** A clear explanation of "what is happening." [cite: 34]
|
| 54 |
+
* [cite_start]**Risk Assessment:** A visual indicator of the risk level (Low, Medium, or High). [cite: 40, 68]
|
| 55 |
+
* [cite_start]**Action Plan:** Targeted next steps (e.g., "mentions notice period violation" or "first action step urgency=high"). [cite: 39, 68]
|
| 56 |
+
* [cite_start]**Key Points:** Critical legal facts detected by the Reasoning Agent. [cite: 66, 68]
|
| 57 |
+
|
| 58 |
+
### 4. Example Scenarios
|
| 59 |
+
| Scenario | Expected Output |
|
| 60 |
+
| :--- | :--- |
|
| 61 |
+
| **Landlord Notice** | [cite_start]Intent: `Notice`, Risk: `Medium`, Action: Notice period validation. [cite: 68] |
|
| 62 |
+
| **Salary Reduction** | [cite_start]Intent: `Contract`, Risk: `Medium`, Action: Wage violation check. [cite: 68] |
|
| 63 |
+
| **Court Judgment** | [cite_start]Intent: `Judgment`, Risk: `High`, Action: Urgent payment/appeal steps. [cite: 68] |
|
| 64 |
+
|
| 65 |
|
| 66 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 67 |
+
|