File size: 3,445 Bytes
1575aea 8d15309 97d13d8 d5500bf 97d13d8 6a660a7 97d13d8 d5500bf 97d13d8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
---
title: Mental Health Emotion Classifier
emoji: ๐ง
colorFrom: indigo
colorTo: blue
sdk: gradio
sdk_version: "4.29.0" # (optional, can leave out if unsure)
app_file: app.py
pinned: false
---
NOTE: Running the app in the space is taking a lot of time for model inference. I suggest you to download the model and app files and run the app locally.
You can download the model from this Hugging Face Hub link: https://huggingface.co/Hrishikesh4/mental-health-classifier-longformer.
# Mental Health Sentiment Analyzer App
The Mental Health Sentiment Analyzer is an AI-powered application that analyzes user text to detect potential signs of mental health states such as depression, anxiety, and stress. The app leverages a fine-tuned Longformer model for multi-label text classification, built with Hugging Face Transformers, and provides explainable predictions with SHAP, along with concise summaries using Cohere API.
This project is deployed on Hugging Face Spaces with a Gradio-based interface.
---
## ๐ Features
- Multi-label classification of user text into categories: depression, anxiety, stress, neutral.
- Explainable AI: SHAP visualizations for understanding model predictions.
- Summary generation for analyzed text using Cohere API.
- User-friendly web interface built with Gradio.
- Deployable on Hugging Face Spaces.
---
## ๐ ๏ธ Tech Stack
- **Language Model:** Fine-tuned Longformer
- **Summarization:** Cohere API
- **Frameworks:** Hugging Face Transformers, PyTorch
- **Interface:** Gradio
- **Explainability:** SHAP
- **Deployment:** Hugging Face Spaces
---
## ๐ Project Structure
```
Mental-Health-Sentiment-Analyzer/
โ
โโโ app/
โ โโโ gradio_interface.py # Gradio UI definition
โ โโโ models/ # Trained model files
โ โ โโโ __init__.py
โ โ โโโ best_thresholds.json
โ โ โโโ sentiment_model.py
โ โโโ utils/ # Explanation and summarizer files
โ โ โโโ __init__.py
โ โ โโโ shap_explainer.py
โ โ โโโ text_summarizer.py
โ
โโโ requirements.txt # Dependencies
โโโ app.py # Entry point for Hugging Face Spaces
โโโ README.md # Project documentation
```
---
## Fine-tuned Model Details
You can access the fine-tuned Longformer model's at this Hugging Face Model link: https://huggingface.co/Hrishikesh4/mental-health-classifier-longformer
## ๐ค Contributors
- Hrishikesh Kurapati (Lead Developer)
---
## ๐ License
mit
---
## ๐ฎ Future Work
- Add support for more mental health categories.
- Improve explainability features.
- Expand dataset for better generalization.
---
## ๐ Acknowledgements
- Hugging Face for Transformers & Spaces.
- Gradio for interactive UI.
---
> โThe model is designed for early detection of mental health risks and can be integrated into wellness or therapy support applications. It works by analyzing a userโs voluntary text inputs โ such as journals, self-reflections, or chatbot interactions โ and identifying patterns of stress, anxiety, or depression. Depending on the userโs consent settings, it can either provide self-help recommendations, notify a therapist, or in high-risk cases, alert a pre-approved emergency contact. The goal is to empower timely intervention while ensuring privacy and ethical use.โ |