π§ Mood Support Chatbot with PPO & GPT-3.5
This project is an AI-powered mental health support chatbot that infers a user's emotional state from natural language input and provides personalized wellness suggestions. It combines:
- GPT-3.5 for mood detection from conversation
- PPO (Proximal Policy Optimization) for reinforcement-learned action selection
- Gradio for an interactive web interface
- Hugging Face Spaces for free public hosting
π Features
- Multi-turn Conversation Context: Mood detection takes the recent chat history into account
- Visual Mood Tracking: A mood trend chart tracks how the user's state evolves
- Personalized Suggestion Memory: Keeps count of which strategies are offered per session
- Custom PPO Policy: Trained in a simulated environment with an expanded action space of 8 wellness suggestions
- Deployment Ready: Packaged and hosted on Hugging Face Spaces with OpenAI key stored securely
π§© Action Space
The agent selects from the following actions:
- meditation π§
- talk_therapy π¬
- journal_prompt π
- breathing_ex π¨
- video π₯
- nature_walk πΏ
- soothing_music πΆ
- gratitude_exercise π
π Training
The PPO agent was trained using stable-baselines3 in a custom Gymnasium environment. The reward is based on simulated mood improvements, and training ends when the mood exceeds a threshold (e.g., 0.95).
Training script includes:
- SimulatedUser with mood boost logic
- MoodSupportEnv with gym-style
reset()andstep() - PPO training loop with model save + zip
π§ͺ How to Test
Use emotional prompts like:
- "I'm so tired and I can't stop overthinking."
- "I'm feeling hopeful but a bit nervous."
- "I don't feel like doing anything."
Or test edge cases like:
- Extremely long emotional rants
- Repeated vague responses ("I don't know")
- Rapid mood swings over turns
π Deployment on Hugging Face Spaces
This project runs on Hugging Face using:
app.py: Main chatbot logic and UIppo_mental_health_model_expanded.zip: Trained PPO modelrequirements.txt: Dependency listOPENAI_API_KEY: Set as a Hugging Face Secret
π§ Future Enhancements
- Mood-aware GPT text responses
- Feedback buttons (π/π) to improve the agent
- Session export or user login
- Local transformer fallback (offline mode)
- Mood milestone alerts ("You've improved by 40%!")
π€ Author
Built and maintained by Chirasmayee B and Pallavi Bichupriya.
π License
MIT License
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support