Inspiration

As the workforce is moving more and more off the factory floor towards personal workspaces, we believe there are unseen health risks that are not being addressed. One of our team member's dad was forced to work from home during covid, and because of his eye strain developed piercing headaches and migraines by the end of every week. Additionally, due to his poor posture, he pinched a nerve in his back, and for six months was unable to walk properly or do any physical activity. So, we decided to build a tool that could fix this: Lance.


What it does

Lance watches your workstation through your laptop camera. It checks posture, hydration, eye strain, and drowsiness. When it spots a problem, it sends a short coaching message. No recording. No blaming.

It also tracks time: stand up reminders every 45 minutes, overwork warnings after 90 minutes.

Supervisors see only patterns, not individual names. Everything runs locally. No video leaves your laptop.


How we built it

Backend: FastAPI Python. Sends frames to GPT-4o for vision analysis. Returns wellness scores for posture, hydration, eye strain, and focus.

Alerts: WellnessTracker class manages time-based alerts. Tracks last standup, last water, bad posture streaks, and total work time.

Coaching: Ollama running locally with llama3 model. Generates short friendly messages based on wellness reports.

Frontend: React with Vite and Tailwind. Shows webcam feed, draws boxes around detected problems. WebSocket pushes real-time alerts. Recharts for posture trends.

Storage: In-memory ring buffer. Holds last 200 incidents. No database needed for hackathon.


Challenges we ran into

Inconsistent GPT outputs. GPT-4o returned posture as a number one time and a string the next. We wrote a parser to force strict JSON schema.

Ollama on Windows. Path issue with WSL. Fixed by reinstalling Ollama and adding install folder to system PATH.

Webcam lag. Sending every frame killed performance. Added 3-second delay between captures. Good enough for wellness checks.

WebSocket drops. Firefox kept disconnecting. Added polling as a fallback.


Accomplishments we're proud of

Full loop working: webcam → GPT → Ollama → alert on screen.

Time-based alerts all trigger correctly. Hydration timer, stand up timer, overwork warning, posture streak detection.

Demo mode with five preset scenarios.

Local Ollama coaching works completely offline. We tested by disconnecting wifi for an hour.


What we learned

GPT-4o is expensive. We burned $20 in one afternoon. Add rate limits and longer delays between frames.

Ollama is slower than cloud models but good enough for coaching. Two to three second response time. Fine for posture reminders, slow for safety alerts.

Privacy-first design is harder than normal development. Every decision required checking what data leaves the machine and who can see it.

Always have a fallback for WebSockets. Polling saved our demo.


What's next for Lance

Voice. Add speech input and output using Web Speech API. Let users ask "how is my posture" and get a spoken answer.

Mobile app. Webcam only works at a desk. Phone app could track posture anywhere using front camera.

Noise monitoring. Factory workers deal with loud environments. Laptop mic could measure decibels and warn about hearing protection.

Proper database. SQLite for one user. PostgreSQL for multiple workstations and shifts.

Workstation design feedback. If ten people at the same station keep getting posture alerts, flag the station as badly designed. Anonymous pattern detection, not punishment.

Built With

Share this project:

Updates