Spaces:
Running
Running
docs: Completely overhaul README with Smart India Hackathon problem framing, new features, and unified setup commands
Browse files
README.md
CHANGED
|
@@ -1,64 +1,112 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
|
| 6 |
-
-
|
| 7 |
-
-
|
| 8 |
-
- **AI/ML**: `wav2vec2` (Emotion Classification), `librosa` (Acoustic Features), `OpenAI Whisper` (Transcription), `GPT-3.5` (Insights/Chat)
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
---
|
| 15 |
|
| 16 |
-
##
|
| 17 |
|
| 18 |
-
|
| 19 |
|
| 20 |
-
### 1. Backend Setup (FastAPI + AI Services)
|
| 21 |
The backend requires Python 3.10+ and downloads ~1.5GB of ML models on first run.
|
|
|
|
| 22 |
```bash
|
| 23 |
cd backend
|
| 24 |
python3 -m venv venv
|
| 25 |
source venv/bin/activate
|
| 26 |
pip install -r requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
-
|
| 29 |
-
|
|
|
|
| 30 |
```
|
|
|
|
| 31 |
|
| 32 |
-
|
| 33 |
|
| 34 |
-
### 2. Frontend Setup (Next.js)
|
| 35 |
```bash
|
| 36 |
cd frontend
|
| 37 |
npm install
|
| 38 |
|
| 39 |
-
# Start the dev server
|
| 40 |
npm run dev
|
| 41 |
```
|
| 42 |
|
| 43 |
-
Visit `http://localhost:3000` to
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
-
### 3. Database Seeding (Optional)
|
| 46 |
-
If you want to test the live backend but don't want to record 30 days of real audio first, you can seed the SQLite database with 30 days of realistic mock entries:
|
| 47 |
```bash
|
| 48 |
cd backend
|
| 49 |
source venv/bin/activate
|
| 50 |
python seed_data.py
|
| 51 |
```
|
| 52 |
-
This generates a user ID. Add that ID to `frontend/.env.local` as `NEXT_PUBLIC_DEMO_USER_ID`.
|
| 53 |
|
| 54 |
---
|
| 55 |
|
| 56 |
-
##
|
| 57 |
-
- **Web Audio API**: Client-side recording with real-time waveform visualization.
|
| 58 |
-
- **Acoustic Extraction**: `librosa` extracts pitch, energy (RMS), tempo, pause duration, and zero-crossing rate (filler words).
|
| 59 |
-
- **Emotion Inference**: HuggingFace `wav2vec2-lg-xlsr-en-speech-emotion-recognition` model lazy-loaded on the server.
|
| 60 |
-
- **Trend Detection**: Week-over-week deviation analysis triggers alerts (e.g., "Mood declined 24%").
|
| 61 |
-
- **State Injection Chat**: Custom GPT context window is injected with the last 30 days of voice metrics before the user asks a question, enabling personalized insights without fine-tuning.
|
| 62 |
|
| 63 |
-
|
| 64 |
-
Audio files are converted in-memory and deleted immediately after the feature-extraction pipeline completes. We only store acoustic metrics (floats), the transcription, and the detected emotion.
|
|
|
|
| 1 |
+
<div align="center">
|
| 2 |
+
<img src="https://raw.githubusercontent.com/LonelyGuy12/InnerVoice/main/frontend/public/logo.png" alt="InnerVoice Logo" width="120" />
|
| 3 |
+
<h1>InnerVoice</h1>
|
| 4 |
+
<p><strong>AI-driven Emotional Wellness Tracker & Proactive Support Network</strong></p>
|
| 5 |
+
</div>
|
| 6 |
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
## 🚀 The Problem
|
| 10 |
+
|
| 11 |
+
*Problem Statement inspired by the Smart India Hackathon framework:*
|
| 12 |
+
|
| 13 |
+
Mental health decline is often a silent trajectory. When individuals experience prolonged periods of stress or depression, their primary support networks—therapists, partners, and close friends—are completely disconnected from their day-to-day emotional state, forcing interventions to be reactive (during a crisis) rather than proactive.
|
| 14 |
+
|
| 15 |
+
Furthermore, traditional written journaling causes high cognitive friction resulting in low adherence, and standard mood-tracking apps rely on subjective 1-to-10 sliders that fail to capture subconscious emotional exhaustion.
|
| 16 |
+
|
| 17 |
+
## 💡 The Solution
|
| 18 |
+
|
| 19 |
+
**InnerVoice** is a full-stack platform that completely removes the friction of self-reflection. Users simply speak their mind for 60 seconds into their device.
|
| 20 |
+
|
| 21 |
+
Instead of just parsing text, InnerVoice **listens**. It utilizes advanced, localized ML models (`wav2vec2`) to extract acoustic features (pitch, speech rate, energetic variance, conversational pauses) to uncover latent emotions.
|
| 22 |
+
|
| 23 |
+
Additionally, InnerVoice breaks the isolation of mental health struggles through its **Trusted Circle** architecture. The platform automatically broadcasts Weekly Emotional Trend Reports (synthesized by an LLM) to a pre-authenticated support system to facilitate early human intervention.
|
| 24 |
+
|
| 25 |
+
---
|
| 26 |
+
|
| 27 |
+
## 🔥 Key Features
|
| 28 |
|
| 29 |
+
1. **Zero-Friction Voice Journaling**
|
| 30 |
+
- Client-side recording with real-time waveform visualization.
|
| 31 |
+
- Immediate audio-to-text transcription powered by OpenAI Whisper.
|
|
|
|
| 32 |
|
| 33 |
+
2. **Acoustic Acoustic Analysis**
|
| 34 |
+
- `librosa` extracts physiological distress markers: pitch deviation, energy (RMS), speech rate, and zero-crossing rate (pauses/filler words).
|
| 35 |
+
- Emotion classification via localized HuggingFace Models (`wav2vec2-lg-xlsr-en-speech-emotion-recognition`).
|
| 36 |
+
|
| 37 |
+
3. **Trusted Circle Architecture (Brevo Integration)**
|
| 38 |
+
- Allow users to invite therapists or partners to their secure network.
|
| 39 |
+
- Proactive broadcasting of LLM-synthesized Weekly Trend Reports directly to via automatic Transactional Emails using the Brevo API.
|
| 40 |
+
- Granular CRUD management of trusted members.
|
| 41 |
+
|
| 42 |
+
4. **Multi-Factor Correlation & Contextual Engagement**
|
| 43 |
+
- **Sleep/Mood Correlation**: Visual and statistical mapping linking sleep deprivation securely to mood degradation.
|
| 44 |
+
- **Contextual Prompts**: AI reads your previous 5 entries to generate highly personalized daily journaling prompts specifically tailored to your emotional state.
|
| 45 |
+
- **Advanced Theming**: Fully responsive Dark/Light mode architecture.
|
| 46 |
+
- **Crisis Safety Net**: Local and international resources triggered automatically.
|
| 47 |
+
|
| 48 |
+
---
|
| 49 |
+
|
| 50 |
+
## 🛠️ Tech Stack
|
| 51 |
+
|
| 52 |
+
- **Frontend**: Next.js 14, React context, TailwindCSS, Recharts, Framer Motion
|
| 53 |
+
- **Backend**: FastAPI, SQLAlchemy, SQLite/PostgreSQL
|
| 54 |
+
- **Communications**: Brevo Transactional Email REST API via `httpx`
|
| 55 |
+
- **AI/ML**: `wav2vec2`, `librosa`, OpenRouter / OpenAI for generation
|
| 56 |
|
| 57 |
---
|
| 58 |
|
| 59 |
+
## ⚙️ Quick Start (Local Deployment)
|
| 60 |
|
| 61 |
+
### 1. Backend Setup
|
| 62 |
|
|
|
|
| 63 |
The backend requires Python 3.10+ and downloads ~1.5GB of ML models on first run.
|
| 64 |
+
|
| 65 |
```bash
|
| 66 |
cd backend
|
| 67 |
python3 -m venv venv
|
| 68 |
source venv/bin/activate
|
| 69 |
pip install -r requirements.txt
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
**Configuration**:
|
| 73 |
+
Rename `.env.example` to `.env` and configure your API keys:
|
| 74 |
+
```env
|
| 75 |
+
OPENROUTER_API_KEY="your_ai_key"
|
| 76 |
+
BREVO_API_KEY="your_brevo_api_key"
|
| 77 |
+
BREVO_SENDER_EMAIL="your_brevo_verified_sender@email.com"
|
| 78 |
+
```
|
| 79 |
|
| 80 |
+
**Run Server**:
|
| 81 |
+
```bash
|
| 82 |
+
python -m uvicorn main:app --reload
|
| 83 |
```
|
| 84 |
+
*API runs locally at http://localhost:8000*
|
| 85 |
|
| 86 |
+
### 2. Frontend Setup
|
| 87 |
|
|
|
|
| 88 |
```bash
|
| 89 |
cd frontend
|
| 90 |
npm install
|
| 91 |
|
| 92 |
+
# Start the dev server
|
| 93 |
npm run dev
|
| 94 |
```
|
| 95 |
|
| 96 |
+
*Visit `http://localhost:3000` to interact with InnerVoice!*
|
| 97 |
+
|
| 98 |
+
### 3. Database Seeding (Testing Mode)
|
| 99 |
+
If you want to test the multi-week timeline and Trusted Circle functionality without recording 30 days of real audio, you can seed the SQLite database with rich mock entries:
|
| 100 |
|
|
|
|
|
|
|
| 101 |
```bash
|
| 102 |
cd backend
|
| 103 |
source venv/bin/activate
|
| 104 |
python seed_data.py
|
| 105 |
```
|
| 106 |
+
This script generates a user ID. Add that ID to your `frontend/.env.local` as `NEXT_PUBLIC_DEMO_USER_ID` or simply browse in the generic UI Demo Mode.
|
| 107 |
|
| 108 |
---
|
| 109 |
|
| 110 |
+
## 🔒 Privacy & Architecture
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
+
Audio files are converted in-memory within the backend ML pipeline and are **deleted securely and immediately** after the acoustic feature-extraction completes. We only permanently store quantified acoustic metrics (floats), the speech transcription string, and the categorical detected emotion.
|
|
|