How wkkyu088/smartmirror_adaptive_ui works
1. This repository is a local desktop application, not a pure web app. The architecture splits into two major runtimes: a TypeScript/React/Electron UI layer and a separate Python computer-vision/ML layer for age detection.
2. The desktop shell is handled by Electron. public/electron.ts / public/electron.js act as the main-process entry point, while public/index.html provides the renderer host. This is the boundary that turns the React app into a standalone smart-mirror application.
3. The renderer UI lives under src/ and is a React + TypeScript single-page interface. src/index.tsx boots the app, App.tsx and MainPage.tsx organize the main screen, and index.css handles the visual presentation.
4. UI state is centralized with Redux. The src/redux/ folder contains store.ts, reducer.ts, actions.ts, types.ts, and RootState.ts, which indicates that adaptive display state is shared across components rather than managed locally inside each widget.
5. The adaptive behavior is the core business flow. According to the README, the UI changes size based on estimated age and adjusts position based on eye level, so the Redux state likely carries camera-derived measurements that drive layout, scaling, and placement of the mirror UI.
6. The ML/computer-vision subsystem is isolated in model/. detect_age.py is the runtime inference script, and wide_resnet.py suggests a pretrained Wide ResNet-based age model. The model folder is separate from the UI code, which makes the ML boundary explicit.
7. The model stack depends on OpenCV, dlib, TensorFlow, and Keras, as listed in model/requirements.txt and the README. That implies the pipeline is likely: camera frame capture → face/landmark processing → age inference → output used by the UI adaptation logic.
8. Flask appears in the model tooling list, so the Python side is likely exposed as a local service or lightweight API, or at minimum was designed to be callable from the Electron app. The exact transport is not shown in the tree, but the architectural boundary is clearly between the Node/Electron side and the Python inference side.
9. The app also has non-ML informational widgets. src/components/CalendarWidget.tsx and src/components/WeatherWidget.tsx show that the mirror dashboard combines adaptive health/utility UI with standard ambient information panels.
10. There is no database or server-side persistence in the repository structure. The system appears to be stateless or session-based, focused on live camera input and immediate UI adaptation rather than stored user profiles.
11. Tooling reinforces the split-stack architecture: package.json / package-lock.json for the Electron-React frontend, model/requirements.txt for the Python ML environment, and tsconfig.json for TypeScript compilation. This is a two-environment project with a desktop shell and a separate vision inference runtime.
12. For an architecture diagram, the key data flow is: camera capture and face analysis in Python, adaptive state propagation into Redux, and React components rendering the smart-mirror UI inside Electron. Calendar and weather are side widgets that sit alongside the adaptive main display.
Main entry points: store.ts Store · MainPage.tsx Main page · index.tsx App boot · detect_age.py Age detect
Components 16
Electron UI runtime
TypeScript/React desktop shell and renderer
- Electron main · Main-process entry that starts the desktop shell
public/electron.ts - HTML host · Renderer entry document for the React app
public/index.html - App boot · Bootstraps the renderer application
src/index.tsx - App shell · Top-level application composition
src/App.tsx - Main page · Primary smart-mirror screen layout
src/MainPage.tsx - Stylesheet · Visual presentation for the renderer
src/index.css - Store · Central state container for adaptive UI
src/redux/store.ts - Reducer/actions · State transitions and action definitions
src/redux/reducer.ts - State types · Shared state and action type definitions
src/redux/types.ts - Root state · Overall state shape for the UI
src/redux/RootState.ts - Calendar · Informational calendar panel
src/components/CalendarWidget.tsx - Weather · Informational weather panel
src/components/WeatherWidget.tsx
Python vision runtime
Age-detection and computer-vision inference layer
- Age detect · Runs age estimation from camera imagery
model/detect_age.py - Wide ResNet · Pretrained age-estimation network definition
model/wide_resnet.py
Project tooling
Build and runtime dependency definitions
- Package config · Electron and React dependency/runtime configuration
package.json - Python deps · Computer-vision and ML runtime dependencies
model/requirements.txt
Connections 18
- Electron main → HTML host: hosts · Electron opens the renderer window
- HTML host → App boot: loads · HTML host loads the React bundle
- App boot → App shell: renders · Bootstrapped app composes the top-level shell
- App shell → Main page: shows · Main application screen is assembled here
- Main page → Calendar: contains · Ambient dashboard widget
- Main page → Weather: contains · Ambient dashboard widget
- App boot → Store: connects · Renderer uses shared adaptive state
- Store → Reducer/actions: uses · Store is driven by reducers and actions
- Reducer/actions → State types: typed by · Actions and state share Redux types
- Store → Root state: shaped by · Store state follows the root state model
- Store → Main page: drives · Adaptive layout state updates the main UI
- Store → Calendar: feeds · Shared app state can reach widgets
- Store → Weather: feeds · Shared app state can reach widgets
- Age detect → Wide ResNet: runs · Inference script uses the age model
- Age detect → Store: publishes · Estimated age and related measurements update UI state
- Package config → Electron main: builds · Node/Electron tooling supports the desktop shell
- Python deps → Age detect: supports · Python environment enables the vision pipeline
- Main page → Stylesheet: styles · Main screen presentation is defined in CSS