Spaces:
Build error
Build error
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,95 +1,12 @@
|
|
| 1 |
-
# ApnaLaw: AI IPC Legal advice Assistant π
|
| 2 |
-
|
| 3 |
-
ApnaLaw is a sophisticated legal advisory chatbot focused on providing detailed and contextually accurate responses about the Indian Penal Code. It utilizes a powerful combination of machine learning technologies to efficiently process and retrieve legal information.
|
| 4 |
-
|
| 5 |
-
---
|
| 6 |
-
|
| 7 |
-
## Features π
|
| 8 |
-
|
| 9 |
-
- **Document Ingestion**: Automated processing of text documents to store legal information in a FAISS vector database.
|
| 10 |
-
- **Real-Time Interaction**: Real-time legal advice through a conversational interface built with Streamlit.
|
| 11 |
-
- **Legal Prompt Templating**: Structured prompt format ensuring clarity, detail, and legal accuracy in responses.
|
| 12 |
-
<br>
|
| 13 |
-
|
| 14 |
-
---
|
| 15 |
-
|
| 16 |
-
<h4><strong>πBlast off to discovery! Our project is waiting for you <a href= "https://huggingface.co/spaces/adarsh-maurya/ApnaLawyer">ApnaLaw</a>. Explore it today and elevate your understanding!π</strong><h4>
|
| 17 |
-
<br>
|
| 18 |
-
|
| 19 |
---
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
| Functionality | Description |
|
| 26 |
-
|----------------------|-------------|
|
| 27 |
-
| **Document Loading** | Loads text documents from a specified directory. |
|
| 28 |
-
| **Text Splitting** | Splits documents into manageable chunks for processing. |
|
| 29 |
-
| **Embedding Generation** | Utilizes `HuggingFace's InLegalBERT` to generate text embeddings. |
|
| 30 |
-
| **FAISS Database** | Indexes embeddings for fast and efficient retrieval. |
|
| 31 |
-
|
| 32 |
-
### Web Application (`app.py`)
|
| 33 |
-
|
| 34 |
-
| Feature | Description |
|
| 35 |
-
|-----------------------|-------------|
|
| 36 |
-
| **Streamlit Interface** | Provides a web interface for user interaction. |
|
| 37 |
-
| **Chat Functionality** | Manages conversational flow and stores chat history. |
|
| 38 |
-
| **Legal Information Retrieval** | Leverages FAISS index to fetch pertinent legal information based on queries.
|
| 39 |
-
|
| 40 |
---
|
| 41 |
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
### Prerequisites
|
| 45 |
-
|
| 46 |
-
- Python 3.8 or later
|
| 47 |
-
- ray
|
| 48 |
-
- langchain
|
| 49 |
-
- streamlit
|
| 50 |
-
- faiss
|
| 51 |
-
|
| 52 |
-
### Installation
|
| 53 |
-
|
| 54 |
-
1. **Clone the repository:**
|
| 55 |
-
```bash
|
| 56 |
-
git clone https://github.com/your-repo/ApnaLaw.git
|
| 57 |
-
cd ApnaLaw
|
| 58 |
-
```
|
| 59 |
-
2. **Install dependencies:**
|
| 60 |
-
```bash
|
| 61 |
-
pip install -r requirements.txt
|
| 62 |
-
```
|
| 63 |
-
3. **Set up the Together AI API Key:**
|
| 64 |
-
Obtain an API key from <a href="https://api.together.xyz/">Together AI</a>.
|
| 65 |
-
Sign up with Together AI today and get $25 worth of free credit! π Whether you choose to use it for a short-term project or opt for a long-term commitment, Together AI offers cost-effective solutions compared to the OpenAI API. π <br><br>
|
| 66 |
-
**> To set this API key as an environment variable on any OS, you can use the following approach:**
|
| 67 |
-
- On macOS and Linux:
|
| 68 |
-
```bash
|
| 69 |
-
echo "export TOGETHER_API_KEY='Your-API-Key-Here'" >> ~/.bash_profile
|
| 70 |
-
source ~/.bash_profile
|
| 71 |
-
```
|
| 72 |
-
- On Windows (using Command Prompt):
|
| 73 |
-
```cmd
|
| 74 |
-
setx TOGETHER_API_KEY "Your-API-Key-Here"
|
| 75 |
-
```
|
| 76 |
-
- On Windows (using PowerShell):
|
| 77 |
-
```powershell
|
| 78 |
-
[Environment]::SetEnvironmentVariable("TOGETHER_API_KEY", "Your-API-Key-Here", "User")
|
| 79 |
-
```
|
| 80 |
-
This key is crucial for the chatbot to access language model functionalities provided by Together AI.
|
| 81 |
-
|
| 82 |
-
## Running the Application
|
| 83 |
-
1. **Run the ingestion script to prepare the data:**
|
| 84 |
-
```bash
|
| 85 |
-
python ingest.py
|
| 86 |
-
```
|
| 87 |
-
2. Launch the Streamlit application:
|
| 88 |
-
```bash
|
| 89 |
-
streamlit run app.py
|
| 90 |
-
```
|
| 91 |
-
---
|
| 92 |
|
| 93 |
-
|
| 94 |
|
| 95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: mit
|
| 3 |
+
title: ApnaLawyer
|
| 4 |
+
sdk: streamlit
|
| 5 |
+
pinned: true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
---
|
| 7 |
|
| 8 |
+
# ApnaLawyer π§ββοΈπ¬
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
ApnaLawyer is a friendly Indian legal chatbot built with Streamlit and powered by HuggingFace, FAISS, Firebase, and Together AI. It helps users understand IPC (Indian Penal Code) laws in simple language with voice and text input options.
|
| 11 |
|
| 12 |
+
> Built by Adarsh Maurya
|