How divyesh-1729/fitpilot works
Purpose and Entry Points
This repository implements a Streamlit-based workout coaching application: it analyzes exercise video/pose data, counts or evaluates repetitions, tracks workout metrics, persists records, and can provide text/voice coaching. The primary application entry point is main.py; Streamlit behavior and theme settings are rooted at .streamlit/config.toml. A separate static landing page is provided at LandingPage/index.html.
Application Composition
The Streamlit UI orchestrates authentication, workout selection, exercise processing, metrics display, and coaching interactions. Shared UI presentation is handled separately from core workout logic:
• main.py
• services/auth/login_wall.py
• services/ui/style_loader.py
• static/style.css
Exercise Domain and Detection Layer
Exercise-specific detectors encapsulate pose-based form/state logic for supported movements. A base abstraction likely defines the contract shared by detector implementations, separating generic exercise lifecycle/state handling from movement-specific rules:
• core/base_exercise.py
• detectors/biceps_curl.py
• detectors/lunges.py
• detectors/pushup.py
• detectors/shoulder_press.py
• detectors/squat.py
Vision Processing Boundary
Video ingestion and pose inference are isolated in the vision service. This boundary should transform frames/video into pose landmarks and detector-ready observations, keeping MediaPipe/model concerns out of Streamlit pages and exercise classes. The packaged pose model is a local runtime asset rather than a remotely hosted inference dependency:
• services/vision/exercise_video_processor.py
• ml_models/pose_landmarker_full.task
• detectors/__init__.py
Session, Workout, and Metrics Flow
At startup, session defaults initialize Streamlit state. Workout configuration selects exercise behavior/settings; processed exercise events feed metrics tracking; resulting summaries are available to UI, persistence, and coaching stages:
• services/state/session_defaults.py
• services/config/workout_config.py
• services/tracking/metrics.py
• core/base_exercise.py
Persistence and Coaching Services
Workout/exercise data is persisted through a repository boundary backed by the included SQLite database. Coaching is modularized into LLM text generation, text-to-speech, and a voice pipeline, allowing coaching outputs to remain downstream of workout analysis rather than embedded in detector code:
• services/persistence/exercise_repository.py
• data.db
• services/coaching/llm.py
• services/coaching/tts.py
• services/coaching/voice_pipeline.py
Runtime and External Dependencies
The runtime is Python with Streamlit, configured through requirements.txt and packages.txt. Material local infrastructure includes SQLite (data.db), the pose-landmarker model (ml_models/pose_landmarker_full.task), and static/font assets. The LLM and TTS modules indicate external AI/voice service integration, though provider credentials and deployment configuration are not present in the repository tree.
Components 17
Streamlit UI
- Streamlit app · Orchestrates authenticated workout sessions.
main.py - Login wall
services/auth/login_wall.py - UI styling
services/ui/style_loader.py - App stylesheet
static/style.css - Landing page
LandingPage/index.html
Exercise Analysis
- Video processor · Converts video frames into detector-ready pose observations.
services/vision/exercise_video_processor.py - Pose landmarker
ml_models/pose_landmarker_full.task - Exercise base · Shared exercise lifecycle and state contract.
core/base_exercise.py - Exercise detectors · Movement-specific form, state, and repetition logic.
detectors/__init__.py
Workout Services
- Session defaults
services/state/session_defaults.py - Workout configuration · Selects exercise behavior and settings.
services/config/workout_config.py - Metrics tracker · Aggregates exercise events into workout summaries.
services/tracking/metrics.py - Exercise repository
services/persistence/exercise_repository.py - Workout database
data.db
Coaching
- Text coach · Generates coaching feedback from workout results.
services/coaching/llm.py - Speech synthesis
services/coaching/tts.py - Voice pipeline
services/coaching/voice_pipeline.py
Connections 18
- Streamlit app → Login wall: gates access
- Streamlit app → UI styling: loads
- UI styling → App stylesheet: applies
- Streamlit app → Session defaults: initializes
- Streamlit app → Workout configuration: selects workout
- Streamlit app → Video processor: submits video
- Video processor → Pose landmarker: runs inference
- Video processor → Exercise detectors: emits pose observations
- Workout configuration → Exercise detectors: configures
- Exercise detectors → Exercise base: implements contract
- Exercise detectors → Metrics tracker: emits exercise events
- Metrics tracker → Streamlit app: provides summaries
- Metrics tracker → Exercise repository: persists records
- Exercise repository → Workout database: reads and writes
- Metrics tracker → Text coach: supplies workout context
- Text coach → Voice pipeline: produces coaching text
- Voice pipeline → Speech synthesis: synthesizes feedback
- Voice pipeline → Streamlit app: returns coaching output