An AI-powered web application for analyzing depression severity and providing personalized mental health support resources.
Features • Installation • Usage • API Documentation • Architecture
- Overview
- Features
- Tech Stack
- Installation
- Quick Start
- Project Structure
- API Documentation
- Configuration
- Development
- Deployment
- Contributing
- License
- Support
Depression Severity Analyzer is a comprehensive mental health assessment platform that uses advanced machine learning to analyze user-provided text and predict depression severity levels. The application provides:
- Real-time Analysis: Process text input and receive immediate severity predictions
- Personalized Recommendations: AI-generated coping strategies tailored to severity level
- Resource Discovery: YouTube video recommendations organized by severity category
- History Tracking: Maintain analysis history for progress monitoring
- Crisis Support: Quick access to mental health resources and helplines
⚠️ Disclaimer: This application is designed as a supportive tool only and should not replace professional mental health evaluation. Always consult qualified mental health professionals for diagnosis and treatment.
- Intelligent Text Analysis: RoBERTa-based transformer model for accurate depression severity classification
- 4-Level Severity Classification: Minimal, Mild, Moderate, Severe
- Confidence Metrics: Risk score and confidence percentage for each analysis
- Timestamp Tracking: Automatic recording of analysis date and time
- Coping Suggestions: AI-generated personalized strategies based on severity level
- Crisis Resources: Emergency hotlines and support contact information
- National Suicide Prevention Lifeline (US)
- Crisis Text Line (SMS support)
- International resources (multiple countries)
-
Severity-Based Categorization: 6 intelligent categories
- All Videos
- Therapy & Counseling
- Meditation & Mindfulness
- Coping Strategies
- Motivation & Positivity
- Daily Habits
-
YouTube Integration: Real-time video fetching with search and filtering
-
Bookmark System: Save favorite videos with persistent storage
-
Professional UI: Clean, responsive design with Feather icons
- Secure Authentication: JWT-based signup and login
- History Tracking: SQLite database for local analysis history
- MongoDB Integration: User data and authentication management
- Responsive Design: Mobile-friendly interface with Tailwind CSS
- Dark Theme: Easy on the eyes with professional color scheme
- Icon-Based UI: Professional Feather icons throughout (no emojis)
- Accessible Navigation: React Router for smooth page transitions
| Technology | Version | Purpose |
|---|---|---|
| React | 18.2.0 | UI Framework |
| React Router | 6.20.0 | Client-side routing |
| Vite | 5.4.21 | Build tool & dev server |
| Tailwind CSS | 3.3.0 | Utility-first styling |
| react-icons | 4.12.0 | Icon library (Feather) |
| Axios | 1.6.0 | HTTP client |
| Technology | Version | Purpose |
|---|---|---|
| Python | 3.11 | Server language |
| FastAPI | Latest | Web framework |
| Uvicorn | Latest | ASGI server |
| SQLAlchemy | Latest | ORM |
| Motor | 3.3.2 | Async MongoDB driver |
| PyMongo | 4.6.0 | MongoDB client |
| Technology | Version | Purpose |
|---|---|---|
| PyTorch | 2.7.1 | Deep learning framework |
| Transformers | 4.36.2 | Hugging Face models |
| RoBERTa | - | Depression severity classifier |
| Database | Purpose |
|---|---|
| SQLite | Analysis history storage |
| MongoDB | User authentication & profiles |
| Service | Purpose |
|---|---|
| YouTube Data API v3 | Video recommendations |
- Python 3.11 or higher
- Node.js 16+ and npm 8+
- Git
- MongoDB (optional, for user authentication)
- YouTube API Key (for video recommendations)
-
Clone the repository
git clone https://github.com/Sanikaa205/depression-prediction.git cd depression-prediction -
Create and activate virtual environment
python -m venv backend/venv # On Windows backend\venv\Scripts\activate # On macOS/Linux source backend/venv/bin/activate
-
Install Python dependencies
cd backend pip install -r requirements.txt -
Configure environment
- Create
.envfile in backend directory (optional) - Set MongoDB connection string if using remote MongoDB
- Configure any other environment-specific settings
- Create
-
Navigate to frontend directory
cd frontend -
Install npm dependencies
npm install
-
Configure YouTube API
- Create
.envfile in frontend directory - Add your YouTube API key:
VITE_YOUTUBE_API_KEY=your_api_key_here - Get your API key: https://developers.google.com/youtube/registering_an_application
- Create
-
Start Backend (Terminal 1)
cd backend source venv/bin/activate # On Windows: venv\Scripts\activate python app.py
Backend will start on
http://localhost:8000 -
Start Frontend (Terminal 2)
cd frontend npm run devFrontend will start on
http://localhost:5175(or next available port) -
Access Application
- Open browser to
http://localhost:5175 - Sign up for an account
- Start analyzing depression severity
- Open browser to
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
depression-prediction/
├── frontend/ # React application
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ │ ├── Navbar.jsx
│ │ │ ├── ProtectedRoute.jsx
│ │ │ ├── RiskMeter.jsx
│ │ │ ├── SeverityBadge.jsx
│ │ │ └── SuicidalAlert.jsx
│ │ ├── pages/ # Page components
│ │ │ ├── Home.jsx
│ │ │ ├── Login.jsx
│ │ │ ├── Signup.jsx
│ │ │ ├── Analyze.jsx
│ │ │ ├── History.jsx
│ │ │ └── Support.jsx
│ │ ├── context/ # Context API state
│ │ │ └── AuthContext.jsx
│ │ ├── api/ # API client
│ │ │ └── axiosClient.js
│ │ ├── App.jsx
│ │ ├── main.jsx
│ │ └── index.css
│ ├── public/
│ ├── package.json
│ ├── vite.config.js
│ ├── tailwind.config.js
│ └── .env # Environment variables
│
├── backend/ # FastAPI application
│ ├── app.py # Main application entry
│ ├── auth.py # Authentication logic
│ ├── database.py # Database configuration
│ ├── schema.py # Pydantic models
│ ├── predict.py # Prediction logic
│ ├── predictor.py # ML model wrapper
│ ├── model_loader.py # Model loading utilities
│ ├── requirements.txt # Python dependencies
│ ├── model/ # ML model files
│ │ ├── config.json
│ │ ├── model.safetensors
│ │ ├── tokenizer_config.json
│ │ ├── vocab.json
│ │ ├── merges.txt
│ │ └── label_mapping.json
│ ├── venv/ # Virtual environment
│ └── depression.db # SQLite database
│
├── SETUP_GUIDE.md # Detailed setup documentation
├── FRONTEND_SETUP_GUIDE.md # Frontend-specific setup
├── TEST_REPORT.md # Test results and validation
└── README.md # This file
POST /auth/signup
Content-Type: application/json
{
"email": "[email protected]",
"password": "securepassword123"
}POST /auth/login
Content-Type: application/json
{
"email": "[email protected]",
"password": "securepassword123"
}
Response:
{
"access_token": "jwt_token_here",
"token_type": "bearer"
}POST /analyze
Authorization: Bearer {token}
Content-Type: application/json
{
"text": "I've been feeling really down lately..."
}
Response:
{
"severity": "Moderate",
"risk_score": 65.4,
"confidence_score": 82.1,
"suggestions": ["...", "..."]
}GET /history
Authorization: Bearer {token}GET /latest-result
Authorization: Bearer {token}
Response:
{
"id": "analysis_id",
"severity": "Moderate",
"risk_score": 65.4,
"confidence_score": 82.1,
"created_at": "2026-04-19T15:19:49.183000",
"coping_suggestions": ["...", "..."]
}GET /healthCreate backend/.env file:
# Database
MONGODB_URL=mongodb+srv://user:[email protected]/depression-prediction
# API Settings
DEBUG=False
SECRET_KEY=your-secret-key-here
# Model Configuration
MODEL_PATH=./model
DEVICE=cuda # or cpuCreate frontend/.env file:
# YouTube API
VITE_YOUTUBE_API_KEY=AIzaSy...
# API Base URL (if using custom backend)
VITE_API_BASE_URL=http://localhost:8000# Backend tests
cd backend
pytest
# Frontend tests
cd frontend
npm testFrontend:
cd frontend
npm run build
# Output: dist/ directoryBackend:
# Backend is ready to run with: python app.py
# For production, use gunicorn:
pip install gunicorn
gunicorn -w 4 -k uvicorn.workers.UvicornWorker app:appPython:
pip install flake8 black
flake8 backend/
black backend/JavaScript:
npm run lint
npm run format- Vercel:
npm run build→ Deploydist/folder - Netlify: Connect GitHub repository for auto-deployment
- GitHub Pages: Configure in
vite.config.js
- Heroku: Include Procfile with Gunicorn
- AWS EC2: Install dependencies and run with systemd service
- Docker: Create Dockerfile and docker-compose.yml
# Build and run with Docker
docker-compose up --buildWe welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch
git checkout -b feature/your-feature-name
- Commit your changes
git commit -m "Add your feature description" - Push to the branch
git push origin feature/your-feature-name
- Open a Pull Request
- Follow PEP 8 for Python code
- Use ESLint/Prettier for JavaScript
- Add tests for new features
- Update documentation as needed
- Be respectful and constructive
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: See SETUP_GUIDE.md and FRONTEND_SETUP_GUIDE.md
- Test Report: Check TEST_REPORT.md for validation details
- API Docs: Access Swagger UI at
/docsendpoint when backend is running - Issues: Report bugs via GitHub Issues
If you're struggling with depression, please reach out to:
- National Suicide Prevention Lifeline: 1-800-273-8255 (US)
- Crisis Text Line: Text HOME to 741741 (US)
- International Association for Suicide Prevention: https://www.iasp.info/resources/Crisis_Centres/
Sanika - Full-stack Developer & AI Enthusiast
- GitHub: @Sanikaa205
- Project Repository: depression-prediction
- Hugging Face for the RoBERTa model
- React and FastAPI communities
- YouTube for the video API
- All contributors and testers
- ✅ Core Features: Complete
- ✅ YouTube Integration: Implemented
- ✅ User Authentication: Functional
- ✅ Analysis History: Operational
- ✅ Crisis Resources: Integrated
- ✅ Production Ready: Yes
Last Updated: April 19, 2026
Latest Release: v1.0.0
Made with ❤️ for mental health awareness
⭐ If you find this project helpful, please consider giving it a star!