avtak's picture
Update README.md
55c9845 verified

A newer version of the Gradio SDK is available: 6.3.0

Upgrade
metadata
title: Early Depression Detection MCP Agent
emoji: 🧠
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 6.2.0
app_file: app.py
pinned: true
tags:
  - mcp-in-action-track-consumer
  - sambanova
  - nebius
  - huggingface
  - depression-detection
  - mental-health
  - longformer
  - mcp
  - agents
license: mit
short_description: Agentic depression detection using Kimi K2/Llama 3

🧠 Early Depression Detection MCP Agent

Hackathon: MCP 1st Birthday - Track 2: MCP in Action (Consumer)
Author: Hassan Hassanzadeh Aliabadi | LinkedIn

πŸ“Ή Demo Video

YOUTUBE LINK

🎯 Project Description

This MCP-enabled agent detects depression risk from social media text by orchestrating specialized tools and LLM reasoning. It is built on Master's thesis research and is rigorously validated, achieving an F1-score of 0.7668 on the eRisk 2025 test data.

πŸ€– Multi-Provider Agent Architecture (MCP in Action)

The agent operates in a two-tier structure:

  1. Tool Layer (The "Eyes"):

    • Tool: detect_depression_risk (My Longformer model).
    • Capability: 4,096-token context window for long user timelines.
    • Core Logic: Implements thesis-derived thresholds (0.4 / 0.6) and classification based on behavioral patterns.
  2. Reasoning Layer (The "Brain"):

    • Purpose: Provides empathetic, research-backed interpretation.
    • Providers: Uses SambaNova (Meta-Llama-3.3) and Nebius (Kimi K2) via the same OpenAI client for enhanced robustness and sponsor stacking.

πŸ§ͺ Thesis Findings Integrated

The agent doesn't just output a probability; it looks for and reports on specific linguistic biomarkers identified in my Master's Thesis:

  • "Nocturnal Posting" & "High-Effort, Low-Frequency": The primary behavioral signature of high-risk users.
  • "Echo Chamber Interaction": The signature of moderate-risk, supportive users engaging with high-risk topics (11.7x higher interaction rate).

πŸ† Research Background

Built on Master's thesis research at University of Malaya:

  • Model: avtak/erisk-longformer-depression-v1.
  • Validation: Rigorous 5-fold cross-validation.
  • Data Augmentation: Used Gemini 2.5 Flash Lite to balance the depressed class.

⚠️ Ethical Considerations

This is a research tool, not a medical diagnostic instrument. Crisis Resources:

  • πŸ†˜ Crisis Text Line: Text HOME to 741741 (US)
  • 🌍 International: befrienders.org