Spaces:
Sleeping
Sleeping
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Live Fitness Trainer Test (WebSocket)</title> | |
| <script src="https://cdn.socket.io/4.7.2/socket.io.min.js"></script> | |
| <style> | |
| body { font-family: sans-serif; display: flex; flex-direction: column; align-items: center; margin: 0; padding: 20px; background-color: #f4f4f4; } | |
| #controls { margin-bottom: 20px; padding: 15px; background-color: #fff; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); } | |
| label, select, button { font-size: 1em; margin: 5px; } | |
| button { padding: 10px 15px; background-color: #007bff; color: white; border: none; border-radius: 4px; cursor: pointer; } | |
| button:disabled { background-color: #ccc; } | |
| button:hover:not(:disabled) { background-color: #0056b3; } | |
| #videoContainer { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; margin-bottom: 20px; } | |
| video { border: 2px solid #007bff; transform: scaleX(-1); border-radius: 8px; background-color: #000; } /* Flip video for mirror effect */ | |
| #feedbackArea { border: 1px solid #ccc; padding: 15px; width: 320px; background-color: #fff; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); } | |
| #feedbackArea h3 { margin-top: 0; color: #007bff; } | |
| #feedbackArea p { margin: 8px 0; } | |
| #feedbackArea span { font-weight: bold; color: #333; } | |
| /* .hidden class is not strictly needed as JS controls display style directly */ | |
| /* However, if used by JS: .hidden { display: none; } */ | |
| </style> | |
| </head> | |
| <body> | |
| <h1>Live Fitness Trainer Test (WebSocket)</h1> | |
| <div id="controls"> | |
| <label for="exerciseTypeSelect">Exercise:</label> | |
| <select id="exerciseTypeSelect"> | |
| <option value="squat">Squat</option> | |
| <option value="push_up">Push Up</option> | |
| <option value="hammer_curl">Hammer Curl</option> | |
| </select> | |
| <button id="startButton">Start Trainer</button> | |
| <button id="stopButton" disabled>Stop Trainer</button> | |
| </div> | |
| <div id="videoContainer"> | |
| <div> | |
| <h3>Your Webcam</h3> | |
| <video id="videoElement" width="320" height="240" autoplay playsinline></video> | |
| </div> | |
| <div id="feedbackArea"> | |
| <h3>Feedback & Status</h3> | |
| <!-- These are not directly updated by websocket_trainer.js but can be kept for manual/other updates if needed --> | |
| <p>Session ID: <span id="sessionIdDisplay">-</span></p> <!-- websocket_trainer.js doesn't update this --> | |
| <p>Status: <span id="statusDisplay">Idle</span></p> <!-- websocket_trainer.js doesn't update this --> | |
| <hr> | |
| <!-- Generic UI for Squat/Push-up --> | |
| <div class="generic-exercise-specific"> | |
| <p>Reps: <span id="repsDisplay">0</span></p> | |
| <p>Stage: <span id="stageDisplay">-</span></p> | |
| <p>Feedback: <span id="feedbackDisplay">-</span></p> | |
| <p>Angle: <span id="angleDisplay">-</span></p> | |
| </div> | |
| <!-- Specific UI for Hammer Curl --> | |
| <div class="hammer-curl-specific" style="display: none;"> <!-- Initially hidden by style, JS will manage --> | |
| <p>Reps Left: <span id="repsLeftDisplay">0</span> | Reps Right: <span id="repsRightDisplay">0</span></p> | |
| <p>Stage Left: <span id="stageLeftDisplay">-</span> | Stage Right: <span id="stageRightDisplay">-</span></p> | |
| <p>Feedback Left: <span id="feedbackLeftDisplay">-</span></p> | |
| <p>Feedback Right: <span id="feedbackRightDisplay">-</span></p> | |
| <!-- The generic 'angleDisplay' is used for hammer curl angles by websocket_trainer.js --> | |
| </div> | |
| </div> | |
| </div> | |
| <script src="static/js/websocket_trainer.js"></script> | |
| </body> | |
| </html> |