Spaces:
Sleeping
Sleeping
Create README.md
Browse files
README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
|
| 2 |
title: Final Year
|
| 3 |
emoji: 📉
|
| 4 |
colorFrom: indigo
|
|
@@ -9,3 +9,118 @@ license: mit
|
|
| 9 |
---
|
| 10 |
|
| 11 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
title: Final Year
|
| 3 |
emoji: 📉
|
| 4 |
colorFrom: indigo
|
|
|
|
| 9 |
---
|
| 10 |
|
| 11 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 12 |
+
=======
|
| 13 |
+
# Semantic Integrity Analysis
|
| 14 |
+
|
| 15 |
+
Legal document analysis web app with authentication, upload, line-level issue detection, and final narrative summary.
|
| 16 |
+
|
| 17 |
+
## Current Architecture
|
| 18 |
+
|
| 19 |
+
- `backend/`: Flask API + SQLite auth + document analysis pipeline
|
| 20 |
+
- `frontend/`: Multi-page static UI
|
| 21 |
+
- `ui/`: Streamlit path (separate from current web flow)
|
| 22 |
+
- `analysis/`: Core analyzer logic
|
| 23 |
+
|
| 24 |
+
## Active User Flow
|
| 25 |
+
|
| 26 |
+
1. `index.html` -> Login / Sign up
|
| 27 |
+
2. `upload.html` -> Upload file + run analysis
|
| 28 |
+
3. `issues.html` -> Line-level issue analysis (duplication, inconsistency, contradiction)
|
| 29 |
+
4. `summary.html` ->
|
| 30 |
+
- Detailed document summary (Page 1, Page 2, ... style)
|
| 31 |
+
- Page-wise summary cards
|
| 32 |
+
- Top findings
|
| 33 |
+
- Line Error Dashboard (exact page/line)
|
| 34 |
+
|
| 35 |
+
## Features
|
| 36 |
+
|
| 37 |
+
- Auth endpoints (`register`, `login`) with SQLite
|
| 38 |
+
- Upload support: `PDF`, `DOCX`, `TXT`
|
| 39 |
+
- Detection categories:
|
| 40 |
+
- Duplication
|
| 41 |
+
- Inconsistency
|
| 42 |
+
- Contradiction
|
| 43 |
+
- Vendor/Vendee extraction
|
| 44 |
+
- Narrative `detailedSummary` + page summaries + line-level dashboard
|
| 45 |
+
|
| 46 |
+
## Backend Setup
|
| 47 |
+
|
| 48 |
+
```bash
|
| 49 |
+
cd backend
|
| 50 |
+
python3 -m venv .venv
|
| 51 |
+
source .venv/bin/activate
|
| 52 |
+
pip install -r requirements.txt
|
| 53 |
+
python3 app.py
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
Backend default: `http://127.0.0.1:5000`
|
| 57 |
+
|
| 58 |
+
## Frontend Setup
|
| 59 |
+
|
| 60 |
+
```bash
|
| 61 |
+
cd frontend
|
| 62 |
+
python3 -m http.server 8080
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
Open: `http://127.0.0.1:8080/index.html`
|
| 66 |
+
|
| 67 |
+
## API Endpoints
|
| 68 |
+
|
| 69 |
+
- `GET /api/health`
|
| 70 |
+
- `POST /api/register`
|
| 71 |
+
- `POST /api/login`
|
| 72 |
+
- `POST /api/analyze`
|
| 73 |
+
|
| 74 |
+
Alias routes also available:
|
| 75 |
+
|
| 76 |
+
- `GET /health`
|
| 77 |
+
- `POST /register`
|
| 78 |
+
- `POST /login`
|
| 79 |
+
- `POST /analyze`
|
| 80 |
+
|
| 81 |
+
## Analyze Response (important keys)
|
| 82 |
+
|
| 83 |
+
- `summary`
|
| 84 |
+
- `pageSummaries`
|
| 85 |
+
- `detailedSummary`
|
| 86 |
+
- `findings`
|
| 87 |
+
- `lineIssues`
|
| 88 |
+
|
| 89 |
+
## Deployment (GitHub + Render)
|
| 90 |
+
|
| 91 |
+
### 1) Push repository
|
| 92 |
+
|
| 93 |
+
```bash
|
| 94 |
+
git add .
|
| 95 |
+
git commit -m "Project setup and web flow"
|
| 96 |
+
git branch -M main
|
| 97 |
+
git remote add origin https://github.com/<your-username>/<your-repo>.git
|
| 98 |
+
git push -u origin main
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
### 2) Deploy backend on Render (Web Service)
|
| 102 |
+
|
| 103 |
+
- Root directory: `backend`
|
| 104 |
+
- Build command:
|
| 105 |
+
|
| 106 |
+
```bash
|
| 107 |
+
pip install -r requirements.txt
|
| 108 |
+
```
|
| 109 |
+
|
| 110 |
+
- Start command:
|
| 111 |
+
|
| 112 |
+
```bash
|
| 113 |
+
gunicorn app:app
|
| 114 |
+
```
|
| 115 |
+
|
| 116 |
+
### 3) Deploy frontend (static)
|
| 117 |
+
|
| 118 |
+
- Option A: Render Static Site (root `frontend`)
|
| 119 |
+
- Option B: GitHub Pages for `frontend/`
|
| 120 |
+
|
| 121 |
+
## Notes
|
| 122 |
+
|
| 123 |
+
- Current `frontend + backend` flow does **not** require `merged_tinyllama_instruction`.
|
| 124 |
+
- Streamlit path under `ui/` may use local TinyLlama model path.
|
| 125 |
+
- If analysis output changes are not visible, restart backend and re-run upload.
|
| 126 |
+
(Create README.md)
|