Spaces:
Running
Running
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,11 +1,100 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
colorTo: indigo
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
license: apache-2.0
|
| 9 |
-
---
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Hugging Face's logo
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
Spaces:
|
| 6 |
+
yamraj047
|
| 7 |
+
/
|
| 8 |
+
lexnepal-api
|
| 9 |
+
|
| 10 |
+
like
|
| 11 |
+
0
|
| 12 |
+
|
| 13 |
+
App
|
| 14 |
+
|
| 15 |
+
Files
|
| 16 |
+
Community
|
| 17 |
+
Settings
|
| 18 |
+
lexnepal-api
|
| 19 |
+
/
|
| 20 |
+
README.md
|
| 21 |
+
|
| 22 |
+
yamraj047's picture
|
| 23 |
+
yamraj047
|
| 24 |
+
Update README.md
|
| 25 |
+
8e57c48
|
| 26 |
+
VERIFIED
|
| 27 |
+
Preview
|
| 28 |
+
Code
|
| 29 |
+
|
|
| 30 |
+
raw
|
| 31 |
+
|
| 32 |
+
Copy download link
|
| 33 |
+
history
|
| 34 |
+
blame
|
| 35 |
+
edit
|
| 36 |
+
delete
|
| 37 |
+
1.44 kB
|
| 38 |
+
metadata
|
| 39 |
+
title: LexNepal AI API
|
| 40 |
+
emoji: ⚖️
|
| 41 |
+
colorFrom: blue
|
| 42 |
colorTo: indigo
|
| 43 |
sdk: docker
|
| 44 |
pinned: false
|
| 45 |
license: apache-2.0
|
|
|
|
| 46 |
|
| 47 |
+
🇳🇵 LexNepal AI API
|
| 48 |
+
|
| 49 |
+
Advanced Legal Intelligence API for Nepal Legal Code using Retrieval-Augmented Generation (RAG).
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
🚀 Features
|
| 53 |
+
|
| 54 |
+
Hybrid Retrieval: Dense vector search + keyword matching
|
| 55 |
+
Cross-Encoder Reranking: Precise relevance scoring
|
| 56 |
+
Zero-Hallucination: Answers only from verified legal texts
|
| 57 |
+
Fast & Free: Optimized for CPU inference
|
| 58 |
+
|
| 59 |
+
🏗️ Architecture
|
| 60 |
+
|
| 61 |
+
Embedding Model: all-mpnet-base-v2 (768D)
|
| 62 |
+
Reranking: MS-MARCO Cross-Encoder
|
| 63 |
+
LLM: Llama 3.3 70B (via Groq)
|
| 64 |
+
Vector DB: FAISS (L2 Index)
|
| 65 |
+
|
| 66 |
+
📡 API Endpoints
|
| 67 |
+
|
| 68 |
+
GET / - Interactive API documentation (Swagger UI)
|
| 69 |
+
GET /health - Health check
|
| 70 |
+
GET /stats - Database statistics
|
| 71 |
+
POST /query - Process legal query
|
| 72 |
+
|
| 73 |
+
💻 Usage Example
|
| 74 |
+
|
| 75 |
+
curl -X POST "https://YOUR_USERNAME-lexnepal-api.hf.space/query" \
|
| 76 |
+
-H "Content-Type: application/json" \
|
| 77 |
+
-d '{
|
| 78 |
+
"query": "What are the penalties for theft in Nepal?",
|
| 79 |
+
"max_sources": 10
|
| 80 |
+
}'
|
| 81 |
+
|
| 82 |
+
🔒 Environment Variables
|
| 83 |
+
|
| 84 |
+
Set GROQ_API_KEY in Space settings for custom API key.
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
📊 Dataset
|
| 88 |
+
|
| 89 |
+
Total Provisions: 6000+
|
| 90 |
+
Legal Documents: 7 Nepal laws
|
| 91 |
+
Vector Dimensions: 768
|
| 92 |
+
|
| 93 |
+
🛠️ Tech Stack
|
| 94 |
+
|
| 95 |
+
FastAPI
|
| 96 |
+
Sentence Transformers
|
| 97 |
+
FAISS
|
| 98 |
+
Groq API
|
| 99 |
+
Docker
|
| 100 |
+
Built with ❤️ for Nepal's legal community
|