Spaces:
Sleeping
Sleeping
A newer version of the Streamlit SDK is available: 1.57.0
metadata
title: Semantic Integrity Analysis
emoji: 🤖
colorFrom: blue
colorTo: green
sdk: streamlit
app_file: app.py
pinned: false
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
Semantic Integrity Analysis
Legal document analysis web app with authentication, upload, line-level issue detection, and final narrative summary.
Current Architecture
backend/: Flask API + SQLite auth + document analysis pipelinefrontend/: Multi-page static UIui/: Streamlit path (separate from current web flow)analysis/: Core analyzer logic
Active User Flow
index.html-> Login / Sign upupload.html-> Upload up to 2 reference files + final file, then run cross-verification analysisissues.html-> Line-level issue analysis (duplication, inconsistency, contradiction)summary.html->- Detailed document summary (Page 1, Page 2, ... style)
- Page-wise summary cards
- Top findings
dashboard.html->- Line error table (exact page/line)
- Reference vs Final mismatch explanation + rectify action
Features
- Auth endpoints (
register,login) with SQLite - Upload support:
PDF,DOCX,TXT - Cross verification: optional 1-2 reference documents + required final document
- Detection categories:
- Duplication
- Inconsistency
- Contradiction
- Vendor/Vendee extraction
- Narrative
detailedSummary+ page summaries + line-level dashboard
Backend Setup
cd backend
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python3 app.py
Backend default: http://127.0.0.1:5000
Frontend Setup
cd frontend
python3 -m http.server 8080
Open: http://127.0.0.1:8080/index.html
API Endpoints
GET /api/healthPOST /api/registerPOST /api/loginPOST /api/analyze
Alias routes also available:
GET /healthPOST /registerPOST /loginPOST /analyze
Analyze Response (important keys)
summarypageSummariesdetailedSummaryfindingslineIssues
Deployment (GitHub + Render)
1) Push repository
git add .
git commit -m "Project setup and web flow"
git branch -M main
git remote add origin https://github.com/<your-username>/<your-repo>.git
git push -u origin main
2) Deploy backend on Render (Web Service)
- Root directory:
backend - Build command:
pip install -r requirements.txt
- Start command:
gunicorn app:app
3) Deploy frontend (static)
- Option A: Render Static Site (root
frontend) - Option B: GitHub Pages for
frontend/
Notes
- Current
frontend + backendflow does not requiremerged_tinyllama_instruction. - Streamlit path under
ui/may use local TinyLlama model path. - If analysis output changes are not visible, restart backend and re-run upload. (Create README.md)