Spaces:
Sleeping
A newer version of the Gradio SDK is available:
6.3.0
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
π― 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:
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.
- Tool:
Reasoning Layer (The "Brain"):
- Purpose: Provides empathetic, research-backed interpretation.
- Providers: Uses SambaNova (Meta-Llama-3.3) and Nebius (Kimi K2) via the same
OpenAIclient 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