Real-time AI-powered productivity assistant that monitors distraction, focus patterns, and gives personalized insights — just like a virtual focus coach.
- Continuously analyzes webcam input (blink rate, gaze, hand gestures)
- Tracks app usage patterns and attention trends
- Calculates a live focus score and distraction confidence
-
Sticky top bar showing session status, focus level, and current time
-
Fixed bottom bar with Quick Actions: Take Break, Start Pomodoro, Block Distractions
-
Charts for focus trend by hour
-
Panels for:
- Eye tracking metrics
- Biometric data (heart rate, posture, stress — simulated or from wearables)
- App usage over time
- Insights & personalized tips
-
Combines:
- Blink rate
- Gaze direction
- App usage
- Hand gestures
- Session trends
-
Uses a rolling 30–60s time window for accuracy (avoids false positives)
-
Detects when you're at risk of distraction before it happens
- Frontend: React + Tailwind (or Shadcn UI)
- Backend: FastAPI + Python ML modules
- Database: SQLite (or PostgreSQL-ready)
focus-guardian/
├── backend/
│ ├── main.py # FastAPI server
│ ├── ml_model.py # Focus prediction logic
│ ├── webcam_utils.py # OpenCV + MediaPipe for face, eye, hand
│ ├── database.py # SQLAlchemy or raw DB layer
│ └── requirements.txt # Backend dependencies
│
├── frontend/
│ ├── src/
│ │ ├── App.tsx # Main app
│ │ ├── components/ # Dashboard UI components
│ │ ├── pages/ # Views: Home, Insights, App Usage
│ │ ├── api/ # Axios calls to backend
│ └── package.json # Frontend dependencies
│
└── README.mdcd backend
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
uvicorn main:app --reloadcd frontend
npm install
npm run devVisit: http://localhost:5173
-
Webcam is accessed using OpenCV
-
MediaPipe tracks:
- Face and eyes → blink rate, gaze
- Hands → fidgeting or distraction
-
App usage simulated (or tracked with local agent)
-
Rolling data buffer (e.g. 30–60s) feeds into model
-
Model returns:
focus_status: focused / at risk / distractedconfidence_score: 0.0–1.0focus_score: daily score, tracked over time
-
Session data logged in the database for insights and trends
Focus Status: At Risk Confidence: 78% Blink Rate: 30/min High switching frequency, gaze drift, low mood rating 💡 You’re most productive between 9–11 AM. Try deep work during this window.
- OAuth login and cloud storage
- Real app usage tracker (cross-platform)
- Wearable integration (Fitbit, Apple Watch, Oura)
- WebSocket-based live updates
- Voice alerts when drift detected
Focus Guardian is built to be privacy-conscious:
- All webcam data is processed locally
- No image or biometric data is uploaded or stored unless explicitly configured
- You control what is tracked and when
Built with ❤️ by Assem — for focus, not surveillance.