madag / index.html
miazaitman's picture
undefined - Initial Deployment
6391a79 verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gym Equipment Guide</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.muscle-diagram {
position: relative;
width: 200px;
height: 300px;
background-image: url('https://cdn.pixabay.com/photo/2017/08/02/00/52/male-figure-2568406_1280.png');
background-size: contain;
background-repeat: no-repeat;
}
.muscle-highlight {
position: absolute;
background-color: rgba(255, 0, 0, 0.5);
border-radius: 50%;
}
.camera-container {
position: relative;
width: 100%;
height: 0;
padding-bottom: 75%;
overflow: hidden;
background-color: #000;
}
.camera-view {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
.camera-controls {
position: absolute;
bottom: 20px;
left: 0;
right: 0;
display: flex;
justify-content: center;
gap: 20px;
}
.flash-effect {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: white;
opacity: 0;
pointer-events: none;
transition: opacity 0.3s;
}
.flash {
opacity: 1;
}
.step-indicator {
width: 30px;
height: 30px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
}
.step-active {
background-color: #3b82f6;
color: white;
}
.step-inactive {
background-color: #e5e7eb;
color: #6b7280;
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.05); }
100% { transform: scale(1); }
}
.pulse-animation {
animation: pulse 2s infinite;
}
</style>
</head>
<body class="bg-gray-100 font-sans">
<div class="max-w-md mx-auto bg-white min-h-screen shadow-lg overflow-hidden">
<!-- Header -->
<header class="bg-blue-600 text-white p-4 flex justify-between items-center">
<h1 class="text-xl font-bold">Gym Equipment Guide</h1>
<button class="bg-blue-700 hover:bg-blue-800 px-3 py-1 rounded-full">
<i class="fas fa-user"></i>
</button>
</header>
<!-- Main Content -->
<main>
<!-- Camera View -->
<div id="cameraSection" class="block">
<div class="p-4">
<h2 class="text-lg font-semibold mb-2">Scan Gym Equipment</h2>
<p class="text-gray-600 mb-4">Take a photo of any gym equipment to get step-by-step instructions on proper usage.</p>
<div class="camera-container rounded-lg shadow-md mb-4">
<div id="flash" class="flash-effect"></div>
<video id="cameraView" class="camera-view" autoplay playsinline></video>
<canvas id="photoCanvas" class="hidden"></canvas>
<div class="camera-controls">
<button id="flipCamera" class="bg-white bg-opacity-30 text-white rounded-full w-10 h-10 flex items-center justify-center">
<i class="fas fa-camera-rotate"></i>
</button>
<button id="takePhoto" class="bg-white rounded-full w-14 h-14 flex items-center justify-center pulse-animation">
<div class="bg-blue-600 rounded-full w-12 h-12"></div>
</button>
<button id="flashToggle" class="bg-white bg-opacity-30 text-white rounded-full w-10 h-10 flex items-center justify-center">
<i class="fas fa-bolt"></i>
</button>
</div>
</div>
<div class="flex justify-between items-center mb-4">
<div class="text-sm text-gray-500">
<i class="fas fa-lightbulb mr-1"></i>
Tip: Make sure the equipment is well-lit and fully visible
</div>
<button class="text-blue-600 font-medium">
<i class="fas fa-question-circle mr-1"></i> Help
</button>
</div>
</div>
</div>
<!-- Results View (hidden by default) -->
<div id="resultsSection" class="hidden">
<div class="p-4">
<div class="flex justify-between items-center mb-4">
<button id="backToCamera" class="text-blue-600 font-medium">
<i class="fas fa-arrow-left mr-1"></i> Back
</button>
<h2 class="text-lg font-semibold">Exercise Guide</h2>
<div class="w-6"></div> <!-- Spacer for alignment -->
</div>
<!-- Equipment Info -->
<div class="bg-blue-50 rounded-lg p-4 mb-4">
<div class="flex items-start">
<div class="mr-4">
<div class="w-16 h-16 bg-blue-100 rounded-lg flex items-center justify-center">
<i class="fas fa-dumbbell text-blue-600 text-2xl"></i>
</div>
</div>
<div>
<h3 class="font-bold text-lg" id="equipmentName">Lat Pulldown Machine</h3>
<p class="text-gray-600" id="equipmentType">Cable Machine</p>
<div class="flex mt-2">
<span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded mr-2">Back</span>
<span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded mr-2">Arms</span>
<span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded">Shoulders</span>
</div>
</div>
</div>
</div>
<!-- Muscle Targeting -->
<div class="bg-white border border-gray-200 rounded-lg p-4 mb-4">
<h3 class="font-semibold mb-3">Muscles Targeted</h3>
<div class="flex">
<div class="muscle-diagram mr-4">
<div class="muscle-highlight" style="width: 60px; height: 40px; top: 80px; left: 70px;"></div> <!-- Lat -->
<div class="muscle-highlight" style="width: 30px; height: 60px; top: 120px; left: 85px;"></div> <!-- Bicep -->
<div class="muscle-highlight" style="width: 50px; height: 30px; top: 70px; left: 75px;"></div> <!-- Rear delt -->
</div>
<div>
<ul class="list-disc pl-5 text-gray-700">
<li class="mb-1">Latissimus Dorsi (Primary)</li>
<li class="mb-1">Biceps Brachii (Secondary)</li>
<li class="mb-1">Trapezius (Secondary)</li>
<li class="mb-1">Rear Deltoids (Secondary)</li>
</ul>
</div>
</div>
</div>
<!-- Instructions -->
<div class="bg-white border border-gray-200 rounded-lg p-4 mb-4">
<h3 class="font-semibold mb-3">Step-by-Step Instructions</h3>
<!-- Step Navigation -->
<div class="flex justify-between mb-4">
<div class="step-indicator step-active">1</div>
<div class="step-indicator step-inactive">2</div>
<div class="step-indicator step-inactive">3</div>
<div class="step-indicator step-inactive">4</div>
<div class="step-indicator step-inactive">5</div>
</div>
<!-- Current Step -->
<div class="bg-blue-50 rounded-lg p-4 mb-3">
<div class="font-bold text-blue-800 mb-2">Step 1: Starting Position</div>
<p>Sit on the machine with your thighs under the pads. Adjust the knee pad height so it fits snugly against your legs.</p>
</div>
<!-- Form Tips -->
<div class="border-l-4 border-blue-500 pl-3 mb-3">
<div class="font-semibold text-blue-800">Form Tip</div>
<p class="text-gray-700">Keep your chest up and maintain a slight arch in your lower back throughout the movement.</p>
</div>
<!-- Common Mistakes -->
<div class="border-l-4 border-red-500 pl-3">
<div class="font-semibold text-red-800">Common Mistake</div>
<p class="text-gray-700">Avoid leaning back too far or using momentum to pull the weight down.</p>
</div>
<!-- Navigation Buttons -->
<div class="flex justify-between mt-4">
<button class="bg-gray-200 hover:bg-gray-300 text-gray-800 font-medium py-2 px-4 rounded-lg">
<i class="fas fa-chevron-left mr-1"></i> Previous
</button>
<button class="bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded-lg">
Next <i class="fas fa-chevron-right ml-1"></i>
</button>
</div>
</div>
<!-- Video Demonstration -->
<div class="bg-white border border-gray-200 rounded-lg p-4">
<h3 class="font-semibold mb-3">Video Demonstration</h3>
<div class="aspect-w-16 aspect-h-9 bg-gray-200 rounded-lg overflow-hidden flex items-center justify-center">
<i class="fas fa-play-circle text-4xl text-blue-600"></i>
</div>
<button class="mt-3 w-full bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded-lg">
<i class="fas fa-play mr-2"></i> Watch Full Tutorial
</button>
</div>
</div>
</div>
</main>
<!-- Footer Navigation -->
<footer class="bg-white border-t border-gray-200 fixed bottom-0 w-full max-w-md">
<div class="flex justify-around p-3">
<button class="text-blue-600 flex flex-col items-center">
<i class="fas fa-camera text-xl"></i>
<span class="text-xs mt-1">Scan</span>
</button>
<button class="text-gray-500 flex flex-col items-center">
<i class="fas fa-dumbbell text-xl"></i>
<span class="text-xs mt-1">Exercises</span>
</button>
<button class="text-gray-500 flex flex-col items-center">
<i class="fas fa-heart text-xl"></i>
<span class="text-xs mt-1">Saved</span>
</button>
<button class="text-gray-500 flex flex-col items-center">
<i class="fas fa-cog text-xl"></i>
<span class="text-xs mt-1">Settings</span>
</button>
</div>
</footer>
</div>
<script>
// DOM Elements
const cameraSection = document.getElementById('cameraSection');
const resultsSection = document.getElementById('resultsSection');
const backToCamera = document.getElementById('backToCamera');
const cameraView = document.getElementById('cameraView');
const photoCanvas = document.getElementById('photoCanvas');
const takePhoto = document.getElementById('takePhoto');
const flipCamera = document.getElementById('flipCamera');
const flashToggle = document.getElementById('flashToggle');
const flash = document.getElementById('flash');
// Camera state
let stream = null;
let facingMode = 'environment';
let flashOn = false;
// Initialize camera
async function initCamera() {
try {
if (stream) {
stream.getTracks().forEach(track => track.stop());
}
const constraints = {
video: {
facingMode: facingMode,
width: { ideal: 1280 },
height: { ideal: 720 }
},
audio: false
};
stream = await navigator.mediaDevices.getUserMedia(constraints);
cameraView.srcObject = stream;
// Set canvas dimensions to match video
const settings = stream.getVideoTracks()[0].getSettings();
photoCanvas.width = settings.width;
photoCanvas.height = settings.height;
} catch (err) {
console.error("Camera error: ", err);
alert("Could not access the camera. Please ensure you've granted camera permissions.");
}
}
// Take photo
takePhoto.addEventListener('click', () => {
const context = photoCanvas.getContext('2d');
context.drawImage(cameraView, 0, 0, photoCanvas.width, photoCanvas.height);
// Flash effect
if (flashOn) {
flash.classList.add('flash');
setTimeout(() => flash.classList.remove('flash'), 300);
}
// Simulate processing
setTimeout(() => {
cameraSection.classList.add('hidden');
resultsSection.classList.remove('hidden');
// In a real app, you would send the photo to your ML model here
// and update the results based on the response
}, 1000);
});
// Flip camera
flipCamera.addEventListener('click', () => {
facingMode = facingMode === 'user' ? 'environment' : 'user';
initCamera();
});
// Toggle flash
flashToggle.addEventListener('click', () => {
flashOn = !flashOn;
flashToggle.innerHTML = flashOn
? '<i class="fas fa-bolt text-yellow-300"></i>'
: '<i class="fas fa-bolt"></i>';
});
// Back to camera
backToCamera.addEventListener('click', () => {
resultsSection.classList.add('hidden');
cameraSection.classList.remove('hidden');
});
// Initialize on load
window.addEventListener('load', () => {
// Check for camera support
if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {
alert('Camera API is not supported in your browser');
return;
}
initCamera();
});
// Clean up on unload
window.addEventListener('beforeunload', () => {
if (stream) {
stream.getTracks().forEach(track => track.stop());
}
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=miazaitman/madag" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>