Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
@@ -1,106 +1,109 @@
|
|
1 |
-
# π§ Mental Health Counselor Assistant
|
2 |
-
|
3 |
-
A privacy-friendly, intelligent assistant designed to help mental health professionals explore **response suggestions** based on patient input. Built with `XGBoost` for intent classification and `Mistral-7B` for natural language generation, this app helps support clinical conversations with empathy and structure β while keeping you in full control.
|
4 |
-
|
5 |
---
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
---
|
17 |
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
- π¬ **Response Generation** β LLM-backed replies using quantized [Mistral-7B](https://mistral.ai/news/announcing-mistral-7b/)
|
22 |
-
- π§ **Multi-turn Memory** β Maintains up to 6 rounds of conversation
|
23 |
-
- β
**Export to JSON + CSV** β With timestamps for traceability
|
24 |
-
- π§° **HIPAA-conscious Design** β No third-party API calls required; all runs locally
|
25 |
|
26 |
---
|
27 |
|
28 |
-
##
|
29 |
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
---
|
33 |
|
34 |
## π How to Run
|
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 |
βββ requirements.txt
|
67 |
βββ Dockerfile
|
68 |
-
βββ
|
69 |
-
βββ
|
|
|
70 |
β βββ Kaggle_Mental_Health_Conversations_train.csv
|
71 |
βββ models/
|
72 |
β βββ mistral-7b-instruct-v0.1.Q4_K_M.gguf
|
73 |
-
βββ
|
74 |
-
βββ
|
|
|
|
|
|
|
75 |
```
|
76 |
|
77 |
---
|
78 |
|
79 |
-
##
|
80 |
-
|
81 |
-
- π§ Used `TfidfVectorizer` + `XGBoost` as a **lightweight, interpretable** classifier
|
82 |
-
- π LLM inference handled locally with `llama-cpp-python` β no external data leaks
|
83 |
-
- π¦ Docker support to simulate realistic deployment and improve portability
|
84 |
-
- π― Optimized for educational and prototyping use in **clinician settings**
|
85 |
-
|
86 |
-
---
|
87 |
-
|
88 |
-
## π Future Improvements
|
89 |
|
90 |
-
|
91 |
-
- Integrate feedback loop for model tuning
|
92 |
-
- Auto-summary of sessions
|
93 |
-
- Hugging Face Space version (hosted with opt-in privacy tradeoffs)
|
94 |
|
95 |
---
|
96 |
|
97 |
-
##
|
98 |
|
99 |
-
|
100 |
|
101 |
---
|
102 |
|
103 |
-
##
|
104 |
|
105 |
-
MIT β
|
106 |
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
title: Counselor Assistant
|
3 |
+
emoji: π§
|
4 |
+
colorFrom: purple
|
5 |
+
colorTo: blue
|
6 |
+
sdk: streamlit
|
7 |
+
sdk_version: "1.32.2"
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
---
|
11 |
+
title: Counselor Assistant
|
12 |
+
emoji: π§
|
13 |
+
colorFrom: purple
|
14 |
+
colorTo: blue
|
15 |
+
sdk: streamlit
|
16 |
+
sdk_version: "1.32.2"
|
17 |
+
app_file: app.py
|
18 |
+
pinned: false
|
19 |
---
|
20 |
|
21 |
+
# π§ Counselor Assistant - AI Support for Mental Health Conversations
|
22 |
|
23 |
+
This Streamlit app helps **mental health counselors** explore supportive language and therapeutic approaches for responding to patient concerns. It leverages a **machine learning classifier** (XGBoost) to detect intent and a **quantized Mistral-7B model** to generate helpful replies.
|
|
|
|
|
|
|
|
|
24 |
|
25 |
---
|
26 |
|
27 |
+
## β
Features
|
28 |
|
29 |
+
- **ML-Based Intent Prediction**: Uses TF-IDF + XGBoost to detect if the message needs validation, advice, information, or follow-up.
|
30 |
+
- **Mistral-7B Counselor Response**: LLM-powered suggestion using your local model (gguf) or Hugging Face-hosted model.
|
31 |
+
- **Multi-turn Memory**: Keeps context from recent messages.
|
32 |
+
- **Word Count + Guidance**: Shows word count to help user compose inputs.
|
33 |
+
- **Conversation Export**: Save to `.csv` or `.json` for recordkeeping.
|
34 |
+
- **Interview-Ready Design**: Friendly UI, emoji icons, prompt examples, and reset options.
|
35 |
|
36 |
---
|
37 |
|
38 |
## π How to Run
|
39 |
|
40 |
+
### π§ͺ Locally (with your own Mistral model)
|
41 |
|
42 |
+
1. Clone the repo:
|
43 |
+
```bash
|
44 |
+
git clone https://github.com/your-username/mental_health_chatbot.git
|
45 |
+
cd mental_health_chatbot
|
46 |
+
```
|
47 |
|
48 |
+
2. Place your **gguf model** under `models/`:
|
49 |
+
```
|
50 |
+
models/mistral-7b-instruct-v0.1.Q4_K_M.gguf
|
51 |
+
```
|
52 |
+
|
53 |
+
3. Create and activate a virtual environment:
|
54 |
+
```bash
|
55 |
+
pip install -r requirements.txt
|
56 |
+
streamlit run app.py
|
57 |
+
```
|
58 |
|
59 |
---
|
60 |
|
61 |
+
### π Deploy on Hugging Face Spaces
|
62 |
|
63 |
+
- β
Use this repo
|
64 |
+
- β
Upload your model or switch to a hosted one like `google/flan-t5-base`
|
65 |
+
- β
Add a `Space` on [Hugging Face](https://huggingface.co/spaces)
|
66 |
+
|
67 |
+
> You can modify `generate_llm_response()` to use Hugging Face's `pipeline` if GPU is not needed.
|
68 |
|
69 |
---
|
70 |
|
71 |
+
## π Folder Structure
|
72 |
|
73 |
```
|
74 |
+
mental_health_chatbot/
|
75 |
β
|
76 |
+
βββ app.py
|
77 |
βββ requirements.txt
|
78 |
βββ Dockerfile
|
79 |
+
βββ README.md
|
80 |
+
βββ LICENSE
|
81 |
+
βββ data/
|
82 |
β βββ Kaggle_Mental_Health_Conversations_train.csv
|
83 |
βββ models/
|
84 |
β βββ mistral-7b-instruct-v0.1.Q4_K_M.gguf
|
85 |
+
βββ utils/
|
86 |
+
β βββ helper_functions.py
|
87 |
+
βββ static/
|
88 |
+
βββ images/
|
89 |
+
βββ demo.gif
|
90 |
```
|
91 |
|
92 |
---
|
93 |
|
94 |
+
## πΈ Screenshot / Demo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
+

|
|
|
|
|
|
|
97 |
|
98 |
---
|
99 |
|
100 |
+
## π©βπ» Why I Built This
|
101 |
|
102 |
+
Mental health professionals often face emotionally complex conversations. This assistant offers **non-binding, thoughtful suggestions** to aid their decision-making β not to replace them, but to **support their professional judgment**.
|
103 |
|
104 |
---
|
105 |
|
106 |
+
## π License
|
107 |
|
108 |
+
MIT License β see [`LICENSE`](./LICENSE)
|
109 |
|