gaurv007 commited on
Commit
85cf385
·
verified ·
1 Parent(s): 9548e93

Fix Space config — add YAML frontmatter

Browse files
Files changed (1) hide show
  1. README.md +12 -118
README.md CHANGED
@@ -1,11 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
  # 🛡️ ClauseGuard — AI Fine Print Scanner
2
 
3
  > Stop signing away your rights. ClauseGuard uses AI to scan Terms of Service, contracts, and legal documents for unfair clauses — instantly.
4
 
5
- **[Live Demo →](https://huggingface.co/spaces/gaurv007/ClauseGuard)**
6
-
7
- ---
8
-
9
  ## What It Does
10
 
11
  ClauseGuard detects **8 types of unfair clauses** based on the CLAUDETTE academic taxonomy:
@@ -21,44 +29,6 @@ ClauseGuard detects **8 types of unfair clauses** based on the CLAUDETTE academi
21
  | 7 | 📜 Choice of Law | 🟠 MEDIUM | Governed by law of a different country |
22
  | 8 | 👆 Contract by Using | 🟡 LOW | Bound by using the service (dark pattern) |
23
 
24
- ---
25
-
26
- ## Project Structure
27
-
28
- ```
29
- clauseguard/
30
- ├── extension/ # Chrome Extension (Manifest V3)
31
- │ ├── manifest.json # Extension config
32
- │ ├── background.js # Service worker — API calls, auth
33
- │ ├── content.js # DOM scanner + highlighter
34
- │ ├── popup.html/js # Quick status popup
35
- │ ├── sidepanel.html/js # Detailed analysis sidebar
36
- │ └── styles/ # Highlight CSS
37
-
38
- ├── web/ # Next.js 15 Website
39
- │ ├── app/ # App Router pages
40
- │ │ ├── page.tsx # Landing page
41
- │ │ ├── dashboard-pages/ # Protected dashboard
42
- │ │ ├── auth/ # Login / Signup
43
- │ │ └── api/ # API routes (analyze, stripe)
44
- │ ├── lib/ # Supabase, Stripe, utilities
45
- │ └── middleware.ts # Auth guard
46
-
47
- ├── api/ # FastAPI Backend
48
- │ ├── main.py # API server with ML inference
49
- │ ├── Dockerfile # Container deployment
50
- │ └── requirements.txt
51
-
52
- ├── ml/ # ML Model Training
53
- │ ├── train_classifier.py # Fine-tune Legal-BERT
54
- │ ├── export_onnx.py # Export to ONNX
55
- │ └── requirements.txt
56
-
57
- └── README.md
58
- ```
59
-
60
- ---
61
-
62
  ## Tech Stack
63
 
64
  | Layer | Technology | Version |
@@ -72,94 +42,18 @@ clauseguard/
72
  | ML (explain) | SaulLM-7B-Instruct | MIT License |
73
  | API | FastAPI + Uvicorn | 0.115.x |
74
 
75
- ---
76
-
77
- ## Quick Start
78
-
79
- ### 1. ML Model Training
80
- ```bash
81
- cd ml
82
- pip install -r requirements.txt
83
- python train_classifier.py
84
- python export_onnx.py
85
- ```
86
-
87
- ### 2. API Backend
88
- ```bash
89
- cd api
90
- pip install -r requirements.txt
91
- uvicorn main:app --reload
92
- # Visit http://localhost:8000/docs
93
- ```
94
-
95
- ### 3. Website
96
- ```bash
97
- cd web
98
- cp .env.example .env.local # Fill in your keys
99
- npm install
100
- npm run dev
101
- # Visit http://localhost:3000
102
- ```
103
-
104
- ### 4. Chrome Extension
105
- 1. Open `chrome://extensions/`
106
- 2. Enable "Developer mode"
107
- 3. Click "Load unpacked" → select `extension/` folder
108
- 4. Visit any Terms of Service page
109
-
110
- ---
111
-
112
- ## Setup Guide
113
-
114
- ### Supabase
115
- 1. Create a project at [supabase.com](https://supabase.com)
116
- 2. Run `web/lib/supabase/schema.sql` in SQL Editor
117
- 3. Enable Google & GitHub OAuth in Auth settings
118
- 4. Copy project URL + anon key to `.env.local`
119
-
120
- ### Stripe
121
- 1. Create products: "ClauseGuard Pro" ($12/mo) and "ClauseGuard Team" ($49/mo)
122
- 2. Copy price IDs to `.env.local`
123
- 3. Set up webhook endpoint: `https://yoursite.com/api/stripe/webhook`
124
- 4. Events to listen for: `customer.subscription.*`, `invoice.payment_failed`
125
-
126
- ### Chrome Web Store
127
- 1. Create developer account ($5 one-time)
128
- 2. Zip the `extension/` folder
129
- 3. Upload at [Chrome Developer Dashboard](https://chrome.google.com/webstore/devconsole)
130
- 4. Fill in description, screenshots, privacy policy
131
- 5. Submit for review (3-7 business days)
132
-
133
- ---
134
-
135
  ## ML Model Details
136
 
137
  - **Base Model**: `nlpaueb/legal-bert-base-uncased` — BERT pre-trained on 12GB legal text
138
  - **Dataset**: `coastalcph/lex_glue` (unfair_tos) — 9,414 clauses, 8 categories
139
  - **Task**: Multi-label classification with BCEWithLogitsLoss
140
  - **Expected Results**: ~83% macro-F1, ~95% micro-F1
141
- - **Inference**: ONNX optimized, ~50-150ms per clause on CPU
142
 
143
  ### Papers
144
  - [CLAUDETTE](https://arxiv.org/abs/1805.01217) — unfair clause taxonomy
145
  - [LexGLUE](https://arxiv.org/abs/2110.00976) — legal NLU benchmark
146
  - [SaulLM-7B](https://arxiv.org/abs/2403.03883) — legal domain LLM
147
 
148
- ---
149
-
150
- ## Pricing
151
-
152
- | | Free | Pro ($12/mo) | Team ($49/mo) |
153
- |---|------|-------------|---------------|
154
- | Scans/month | 10 | Unlimited | Unlimited |
155
- | Clause categories | 8 | 8 | 8 |
156
- | AI explanations | ❌ | ✅ | ✅ |
157
- | PDF exports | ❌ | ✅ | ✅ |
158
- | API access | ❌ | 1K calls | 10K calls |
159
- | Team seats | 1 | 1 | 5 |
160
-
161
- ---
162
-
163
  ## License
164
 
165
  MIT License. Not legal advice — always consult a qualified attorney.
 
1
+ ---
2
+ title: ClauseGuard
3
+ emoji: 🛡️
4
+ colorFrom: indigo
5
+ colorTo: red
6
+ sdk: gradio
7
+ sdk_version: "5.23.0"
8
+ python_version: "3.12"
9
+ app_file: app.py
10
+ pinned: false
11
+ ---
12
+
13
  # 🛡️ ClauseGuard — AI Fine Print Scanner
14
 
15
  > Stop signing away your rights. ClauseGuard uses AI to scan Terms of Service, contracts, and legal documents for unfair clauses — instantly.
16
 
 
 
 
 
17
  ## What It Does
18
 
19
  ClauseGuard detects **8 types of unfair clauses** based on the CLAUDETTE academic taxonomy:
 
29
  | 7 | 📜 Choice of Law | 🟠 MEDIUM | Governed by law of a different country |
30
  | 8 | 👆 Contract by Using | 🟡 LOW | Bound by using the service (dark pattern) |
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  ## Tech Stack
33
 
34
  | Layer | Technology | Version |
 
42
  | ML (explain) | SaulLM-7B-Instruct | MIT License |
43
  | API | FastAPI + Uvicorn | 0.115.x |
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  ## ML Model Details
46
 
47
  - **Base Model**: `nlpaueb/legal-bert-base-uncased` — BERT pre-trained on 12GB legal text
48
  - **Dataset**: `coastalcph/lex_glue` (unfair_tos) — 9,414 clauses, 8 categories
49
  - **Task**: Multi-label classification with BCEWithLogitsLoss
50
  - **Expected Results**: ~83% macro-F1, ~95% micro-F1
 
51
 
52
  ### Papers
53
  - [CLAUDETTE](https://arxiv.org/abs/1805.01217) — unfair clause taxonomy
54
  - [LexGLUE](https://arxiv.org/abs/2110.00976) — legal NLU benchmark
55
  - [SaulLM-7B](https://arxiv.org/abs/2403.03883) — legal domain LLM
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  ## License
58
 
59
  MIT License. Not legal advice — always consult a qualified attorney.