File size: 5,420 Bytes
a578794
5ef3aa7
 
 
 
a578794
71f359b
a578794
 
5ef3aa7
 
 
 
 
 
 
 
 
 
 
 
a578794
 
5ef3aa7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
---
title: Psychology AI Assistant
emoji: 🧠
colorFrom: purple
colorTo: blue
sdk: gradio
sdk_version: 5.34.2
app_file: app.py
pinned: false
license: apache-2.0
models:
- Qwen/Qwen2.5-0.5B
- phxdev/psychology-qwen-0.5b
tags:
- psychology
- mental-health
- therapy
- counseling
- peft
- qwen
- fine-tuned
---

# 🧠 Psychology AI Assistant

An empathetic AI assistant fine-tuned for psychology and mental health support. Based on Qwen 2.5-0.5B with specialized training using PEFT/LoRA techniques.

## ✨ Features

- **Empathetic Responses**: Fine-tuned specifically for psychology and mental health conversations
- **Multiple Support Styles**: Choose from therapeutic, supportive friend, crisis support, anxiety coaching, or mindfulness guidance
- **Evidence-Based Approach**: Responses grounded in psychological principles and therapeutic techniques
- **Interactive Interface**: Modern, accessible design with conversation starters and customizable settings
- **Privacy-Focused**: No conversation data is stored or logged

## 🎯 Model Details

- **Base Model**: [Qwen/Qwen2.5-0.5B](https://huggingface.co/Qwen/Qwen2.5-0.5B)
- **Fine-tuned Model**: [phxdev/psychology-qwen-0.5b](https://huggingface.co/phxdev/psychology-qwen-0.5b)
- **Training Method**: PEFT (Parameter Efficient Fine-Tuning) with LoRA
- **Specialization**: Psychology, mental health, therapeutic communication
- **Parameters**: ~500M parameters (0.5B)
- **Context Length**: 2048 tokens

## πŸš€ How to Use

1. **Start a Conversation**: Type your thoughts, concerns, or questions in the chat box
2. **Choose Your Style**: Select the type of support you prefer from the dropdown menu
3. **Adjust Settings**: Customize response creativity and length to your preference
4. **Try Examples**: Click on any of the conversation starters for common scenarios

### Support Styles Available:

- **πŸ”¬ Therapeutic**: Professional therapist approach with validation and structured guidance
- **πŸ‘₯ Supportive Friend**: Warm, caring friend who studied psychology  
- **πŸ†˜ Crisis Support**: Immediate support and grounding techniques for crisis situations
- **😰 Anxiety Coach**: Specialized techniques for managing anxiety and panic
- **🧘 Mindfulness Guide**: Present-moment awareness and self-compassion practices

## ⚠️ Important Disclaimer

This AI assistant provides supportive guidance based on psychological principles, but it is **not a replacement for professional therapy or medical advice**. 

If you're experiencing a mental health crisis, please contact:
- **988 Suicide & Crisis Lifeline**: Call or text 988
- **Crisis Text Line**: Text HOME to 741741
- **Emergency Services**: Call 911 (US) or your local emergency number

## πŸ› οΈ Technical Implementation

The model uses advanced prompt engineering and fine-tuning techniques to provide contextually appropriate responses:

- **PEFT Training**: Efficient fine-tuning preserving base model capabilities while adding psychology specialization
- **Prompt Templates**: Multiple specialized templates for different therapeutic approaches
- **Response Quality**: Built-in safeguards against generic or unhelpful responses
- **Mobile Optimized**: Responsive design works well on all devices

## 🎨 Interface Features

- **Clean Design**: Modern, calming interface designed for sensitive conversations
- **Conversation History**: Full chat history maintained during your session
- **Example Prompts**: Curated conversation starters for common mental health topics
- **Accessibility**: Screen reader friendly and keyboard navigable
- **Privacy**: No data logging or conversation storage

## πŸ”§ Model Performance

The fine-tuned model shows significant improvements over the base Qwen model in:

- **Empathy**: Better emotional validation and understanding
- **Practical Advice**: More actionable, specific guidance 
- **Psychological Awareness**: Understanding of mental health concepts and terminology
- **Conversational Flow**: Natural, supportive dialogue without generic responses

## πŸ“Š Example Use Cases

- **Stress Management**: Work stress, academic pressure, life transitions
- **Anxiety Support**: Panic attacks, social anxiety, general worry
- **Relationship Guidance**: Communication skills, boundary setting, conflict resolution
- **Self-Esteem**: Building confidence, overcoming negative self-talk
- **Mindfulness**: Present-moment awareness, meditation guidance, self-compassion
- **Grief Support**: Processing loss, coping with change

## 🀝 Contributing & Feedback

This model is part of ongoing research into AI applications for mental health support. If you have feedback or suggestions:

- **Model Issues**: Report on the [model repository](https://huggingface.co/phxdev/psychology-qwen-0.5b)
- **Interface Bugs**: Open an issue on this Space
- **Research Collaboration**: Contact [@phxdev](https://huggingface.co/phxdev)

## πŸ“š Related Resources

- **Base Model**: [Qwen/Qwen2.5-0.5B](https://huggingface.co/Qwen/Qwen2.5-0.5B)
- **PEFT Library**: [huggingface/peft](https://github.com/huggingface/peft)
- **Mental Health Resources**: [National Alliance on Mental Illness](https://nami.org)

## πŸ“„ License

This Space and the fine-tuned model are released under the Apache 2.0 License. The base Qwen model follows its original licensing terms.

---

**Built with ❀️ by [@phxdev](https://huggingface.co/phxdev) using Gradio and HuggingFace Transformers**