LeahRocks commited on
Commit
057e606
Β·
verified Β·
1 Parent(s): 3c8fa92

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +162 -7
README.md CHANGED
@@ -1,10 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
- title: SafeStream AI
3
- emoji: πŸ’»
4
- colorFrom: yellow
5
- colorTo: gray
6
- sdk: docker
7
- pinned: false
 
 
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SafeStream AI β€” Intelligent Content Moderation
2
+
3
+ > AI-powered content moderation using rule-based scoring and reinforcement learning for smarter, faster, and more adaptive decisions.
4
+
5
+ ---
6
+
7
+ ## Features
8
+
9
+ - **AI toxicity analysis** β€” scores content across multiple harm categories
10
+ - **RL-driven decision engine** β€” outputs one of: Allow / Flag / Remove / Review
11
+ - **Confidence scoring** β€” quantified certainty on every moderation decision
12
+ - **Category breakdown** β€” per-content scores for toxicity, insult, threat, and obscene language
13
+ - **Live moderation history** β€” running log of past decisions in the dashboard
14
+ - **Real-time stats** β€” dashboard metrics updated on every request
15
+ - **Modern UI** β€” clean gradient-styled interface
16
+
17
+ ---
18
+
19
+ ## Architecture
20
+
21
+ ```
22
+ Frontend (HTML/CSS/JS)
23
+ ↓
24
+ FastAPI Backend (/moderate)
25
+ ↓
26
+ AI + RL Decision Logic
27
+ ↓
28
+ Structured Moderation Output
29
+ ```
30
+
31
  ---
32
+
33
+ ## Tech Stack
34
+
35
+ | Layer | Technology |
36
+ |-------------|-------------------------------------|
37
+ | Frontend | HTML, CSS, JavaScript |
38
+ | Backend | FastAPI (Python) |
39
+ | Deployment | Hugging Face Spaces (Docker) |
40
+ | Model logic | Rule-based scoring + AI (extendable)|
41
+
42
  ---
43
 
44
+ ## Project Structure
45
+
46
+ ```
47
+ .
48
+ β”œβ”€β”€ app.py
49
+ β”œβ”€β”€ requirements.txt
50
+ β”œβ”€β”€ Dockerfile
51
+ β”œβ”€β”€ templates/
52
+ β”‚ └── index.html
53
+ └── static/
54
+ β”œβ”€β”€ styles.css
55
+ β”œβ”€β”€ script.js
56
+ └── logo.jpeg
57
+ ```
58
+
59
+ ---
60
+
61
+ ## How It Works
62
+
63
+ 1. User submits text via the dashboard
64
+ 2. Frontend sends a `POST` request to `/moderate`
65
+ 3. Backend analyzes the content using AI scoring + RL logic
66
+ 4. Response includes a decision, confidence score, explanation, and category breakdown
67
+ 5. Dashboard updates in real time
68
+
69
+ ---
70
+
71
+ ## API Reference
72
+
73
+ ### `POST /moderate`
74
+
75
+ **Request body:**
76
+ ```json
77
+ {
78
+ "text": "Your content here"
79
+ }
80
+ ```
81
+
82
+ **Response:**
83
+ ```json
84
+ {
85
+ "decision": "flag",
86
+ "confidence": 0.85,
87
+ "explanation": "Potentially harmful content detected",
88
+ "ai_scores": {
89
+ "toxicity": 0.8,
90
+ "insult": 0.6,
91
+ "threat": 0.7,
92
+ "obscene": 0.5
93
+ }
94
+ }
95
+ ```
96
+
97
+ **Decision values:** `allow` Β· `flag` Β· `remove` Β· `review`
98
+
99
+ ---
100
+
101
+ ## Running Locally
102
+
103
+ **1. Clone the repository**
104
+ ```bash
105
+ git clone <your-repo-url>
106
+ cd safestream-ai
107
+ ```
108
+
109
+ **2. Install dependencies**
110
+ ```bash
111
+ pip install -r requirements.txt
112
+ ```
113
+
114
+ **3. Start the server**
115
+ ```bash
116
+ uvicorn app:app --reload
117
+ ```
118
+
119
+ **4. Open in browser**
120
+ ```
121
+ http://127.0.0.1:8000
122
+ ```
123
+
124
+ ---
125
+
126
+ ## Deployment
127
+
128
+ This project is deployed on **Hugging Face Spaces** using Docker.
129
+
130
+ - `Dockerfile` handles container setup
131
+ - FastAPI app runs on port `7860`
132
+
133
+ ---
134
+
135
+ ## Roadmap
136
+
137
+ - [ ] Integrate real LLM (OpenAI / Anthropic / Perspective API)
138
+ - [ ] Train RL agent dynamically on moderation feedback
139
+ - [ ] Analytics dashboard with charts
140
+ - [ ] Multi-language moderation support
141
+ - [ ] User authentication and persistent moderation logs
142
+ - [ ] Real-time streaming moderation
143
+ - [ ] Webhook support for external integrations
144
+
145
+ ---
146
+
147
+ ## Use Cases
148
+
149
+ - Social media platforms
150
+ - Community forums and Discord servers
151
+ - Live chat and messaging apps
152
+ - Online gaming platforms
153
+ - Content safety pipelines
154
+
155
+ ---
156
+
157
+ ## Author
158
+
159
+ Built by Team **Good Girls Guide to AI** Β· Systems Β· Product
160
+
161
+ ---
162
+
163
+ ## Inspiration
164
+
165
+ As online content grows exponentially, scalable and intelligent moderation becomes critical infrastructure. SafeStream AI explores how AI and reinforcement learning can work together to make moderation smarter, faster, and more adaptive β€” reducing both false positives and harmful content slipping through.