Skip to content

AI-powered suicide risk classification system with explainable predictions using SHAP and LIME.

License

Notifications You must be signed in to change notification settings

creme332/suicide-detector

Repository files navigation

Suicide Risk Classification Web App

An AI-powered text analysis tool with explainable predictions using SHAP and LIME for suicide risk detection. See report at report.pdf.

GIF of website showing LIME and SHAP result

Model Information

  • Accuracy: 92%
  • Base Model: BERT (bert-base-uncased)
  • Dataset: Kaggle Suicide and Depression Detection (12,000+ samples)
  • Labels: Binary classification (Suicidal / Non-Suicidal)

Features

  • Real-time text classification
  • SHAP (SHapley Additive exPlanations) visualizations
  • LIME (Local Interpretable Model-agnostic Explanations) analysis
  • Minimalist black & white UI
  • REST API endpoint
  • Production-ready with Gunicorn

Prerequisites

  • Python 3.10+
  • Git
  • Git LFS (for model files)
  • UV package manager (recommended) or pip

Quick Setup

Option 1: Using UV (Recommended)

# Clone repository
git clone git@github.com:creme332/suicide-detector.git
cd suicide-detector

# Create virtual environment and install dependencies
uv venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
uv pip install -r requirements.txt

# Run the app
uv run python app.py

Option 2: Using pip

# Clone repository
git clone git@github.com:creme332/suicide-detector.git
cd suicide-detector

# Create virtual environment
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Run the app
python app.py

Access the app at http://localhost:5000 in your browser.

API Usage

curl -X POST http://localhost:5000/api/predict \
  -H "Content-Type: application/json" \
  -d '{"text": "I feel hopeless and dont want to live"}'

Tech Stack

  • Backend: Flask
  • ML Framework: PyTorch, Transformers
  • Explainability: SHAP, LIME
  • Frontend: HTML, CSS, JavaScript
  • Deployment: Gunicorn

Collaborators

About

AI-powered suicide risk classification system with explainable predictions using SHAP and LIME.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages