How imad-ah/spam-detection-system works
SafeMail is a Flask-based spam-detection dashboard. A user submits a message for single inference or uploads a CSV for batch analysis; the server tokenizes text, runs a local DistilBERT sequence classifier, and returns labels and confidence scores. The dashboard also presents analysis history, statistics, charts, and tools for filtering and exporting results. The sampled backend establishes its routes and inference flow; some dashboard behaviors are documented or visible only in partial JavaScript excerpts, so those connections are marked unverified.
Main entry points: app.py Prediction function · script.js Single-message form · index.html Dashboard page · model.safetensors Model assets
Components 18
Dashboard UI
- Dashboard page
templates/index.html - Dashboard interactions
static/script.js - Single-message form
static/script.js - CSV upload form
static/script.js - Results and tools
static/script.js - History and charts
static/script.js - Language options
static/script.js
Web and Analysis
- Flask application
app.py - Dashboard route
app.py - Single prediction route
app.py - CSV prediction route
app.py - CSV analysis
app.py
Model Inference
- Prediction function
app.py - Text tokenizer
app.py - Sequence classifier
app.py - Model assets
model.safetensors - Tokenizer assets
tokenizer.json
Other components
- Dashboard user
Connections 22
- Dashboard user → Dashboard page: opens
README.md - Dashboard page → Flask application: served by
app.py - Flask application → Dashboard route: routes
app.py - Dashboard route → Dashboard page: renders
app.py - Dashboard user → Single-message form: enters text
README.md - Single-message form → Single prediction route: submits
- Single prediction route → Prediction function: calls
app.py - Dashboard user → CSV upload form: uploads CSV
README.md - CSV upload form → CSV prediction route: submits
- CSV prediction route → CSV analysis: analyzes
app.py - CSV analysis → Prediction function: classifies rows
app.py - Prediction function → Text tokenizer: tokenizes
app.py - Prediction function → Sequence classifier: runs inference
app.py - Sequence classifier → Model assets: loads weights
app.py - Text tokenizer → Tokenizer assets: loads vocabulary
app.py - Single prediction route → Single-message form: returns result
app.py - CSV prediction route → Results and tools: returns rows
- Dashboard interactions → Single-message form: handles
static/script.js - Dashboard interactions → CSV upload form: handles
static/script.js - Results and tools → History and charts: updates views
static/script.js - Results and tools → Dashboard user: exports results
- Language options → Dashboard interactions: localizes
static/script.js