Spaces:
Running
Running
Add 3 files
Browse files- README.md +6 -4
- index.html +283 -19
- prompts.txt +2 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
colorTo: red
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: vitality-bmi
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: red
|
| 5 |
colorTo: red
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,283 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Vitality BMI Calculator</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.6.0/dist/confetti.browser.min.js"></script>
|
| 9 |
+
<style>
|
| 10 |
+
:root {
|
| 11 |
+
--bg-primary: #f8fafc;
|
| 12 |
+
--bg-secondary: #ffffff;
|
| 13 |
+
--text-primary: #1e293b;
|
| 14 |
+
--text-secondary: #64748b;
|
| 15 |
+
--accent: #0ea5e9;
|
| 16 |
+
--border: #e2e8f0;
|
| 17 |
+
--underweight: #06b6d4;
|
| 18 |
+
--normal: #10b981;
|
| 19 |
+
--overweight: #f59e0b;
|
| 20 |
+
--obese: #ef4444;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
.dark {
|
| 24 |
+
--bg-primary: #0f172a;
|
| 25 |
+
--bg-secondary: #1e293b;
|
| 26 |
+
--text-primary: #f8fafc;
|
| 27 |
+
--text-secondary: #94a3b8;
|
| 28 |
+
--accent: #38bdf8;
|
| 29 |
+
--border: #334155;
|
| 30 |
+
--underweight: #22d3ee;
|
| 31 |
+
--normal: #34d399;
|
| 32 |
+
--overweight: #fbbf24;
|
| 33 |
+
--obese: #f87171;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
body {
|
| 37 |
+
background-color: var(--bg-primary);
|
| 38 |
+
color: var(--text-primary);
|
| 39 |
+
transition: all 0.3s ease;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
.card {
|
| 43 |
+
background-color: var(--bg-secondary);
|
| 44 |
+
border-color: var(--border);
|
| 45 |
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
.input-dial {
|
| 49 |
+
width: 120px;
|
| 50 |
+
height: 120px;
|
| 51 |
+
border-radius: 50%;
|
| 52 |
+
background: var(--bg-secondary);
|
| 53 |
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
| 54 |
+
display: flex;
|
| 55 |
+
flex-direction: column;
|
| 56 |
+
justify-content: center;
|
| 57 |
+
align-items: center;
|
| 58 |
+
position: relative;
|
| 59 |
+
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
.input-dial:hover {
|
| 63 |
+
transform: translateY(-2px);
|
| 64 |
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
.bmi-bar {
|
| 68 |
+
width: 24px;
|
| 69 |
+
height: 200px;
|
| 70 |
+
border-radius: 12px;
|
| 71 |
+
background: linear-gradient(to top, var(--underweight), var(--normal), var(--overweight), var(--obese));
|
| 72 |
+
position: relative;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
.bmi-indicator {
|
| 76 |
+
width: 36px;
|
| 77 |
+
height: 8px;
|
| 78 |
+
border-radius: 4px;
|
| 79 |
+
background-color: var(--bg-secondary);
|
| 80 |
+
position: absolute;
|
| 81 |
+
left: -6px;
|
| 82 |
+
transform: translateY(-4px);
|
| 83 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
.bmi-category {
|
| 87 |
+
transition: all 0.3s ease;
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
.bmi-category.active {
|
| 91 |
+
transform: scale(1.05);
|
| 92 |
+
font-weight: 600;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
@keyframes pulse {
|
| 96 |
+
0% { transform: scale(1); }
|
| 97 |
+
50% { transform: scale(1.05); }
|
| 98 |
+
100% { transform: scale(1); }
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
.celebrate {
|
| 102 |
+
animation: pulse 1.5s infinite;
|
| 103 |
+
}
|
| 104 |
+
</style>
|
| 105 |
+
</head>
|
| 106 |
+
<body class="min-h-screen flex flex-col items-center justify-center p-4 font-sans">
|
| 107 |
+
<div class="w-full max-w-md mx-auto">
|
| 108 |
+
<div class="flex justify-between items-center mb-6">
|
| 109 |
+
<h1 class="text-3xl font-bold bg-gradient-to-r from-teal-400 to-coral-500 bg-clip-text text-transparent">Vitality BMI</h1>
|
| 110 |
+
<button id="theme-toggle" class="p-2 rounded-full hover:bg-gray-200 dark:hover:bg-gray-700 transition">
|
| 111 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 112 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z" />
|
| 113 |
+
</svg>
|
| 114 |
+
</button>
|
| 115 |
+
</div>
|
| 116 |
+
|
| 117 |
+
<div class="card rounded-2xl shadow-xl p-6 mb-6">
|
| 118 |
+
<div class="flex justify-between items-center mb-8">
|
| 119 |
+
<div class="input-dial">
|
| 120 |
+
<label for="height" class="text-sm font-medium text-gray-500 dark:text-gray-400">Height (cm)</label>
|
| 121 |
+
<input id="height" type="number" class="text-3xl font-bold text-center bg-transparent border-none w-20 focus:outline-none focus:ring-0" value="170" min="100" max="250">
|
| 122 |
+
</div>
|
| 123 |
+
|
| 124 |
+
<div class="input-dial">
|
| 125 |
+
<label for="weight" class="text-sm font-medium text-gray-500 dark:text-gray-400">Weight (kg)</label>
|
| 126 |
+
<input id="weight" type="number" class="text-3xl font-bold text-center bg-transparent border-none w-20 focus:outline-none focus:ring-0" value="70" min="30" max="200">
|
| 127 |
+
</div>
|
| 128 |
+
</div>
|
| 129 |
+
|
| 130 |
+
<div class="flex items-center justify-between mb-8">
|
| 131 |
+
<div class="flex-1">
|
| 132 |
+
<div class="text-5xl font-bold mb-2" id="bmi-value">24.2</div>
|
| 133 |
+
<div class="text-lg font-medium" id="bmi-category-text">Normal weight</div>
|
| 134 |
+
</div>
|
| 135 |
+
|
| 136 |
+
<div class="relative">
|
| 137 |
+
<div class="bmi-bar">
|
| 138 |
+
<div class="bmi-indicator" id="bmi-indicator" style="top: 50%"></div>
|
| 139 |
+
</div>
|
| 140 |
+
</div>
|
| 141 |
+
</div>
|
| 142 |
+
|
| 143 |
+
<div class="grid grid-cols-4 gap-2 text-center text-sm">
|
| 144 |
+
<div class="bmi-category" id="underweight">
|
| 145 |
+
<div class="font-medium">Underweight</div>
|
| 146 |
+
<div class="text-xs text-gray-500 dark:text-gray-400">< 18.5</div>
|
| 147 |
+
</div>
|
| 148 |
+
<div class="bmi-category" id="normal">
|
| 149 |
+
<div class="font-medium">Normal</div>
|
| 150 |
+
<div class="text-xs text-gray-500 dark:text-gray-400">18.5 - 24.9</div>
|
| 151 |
+
</div>
|
| 152 |
+
<div class="bmi-category" id="overweight">
|
| 153 |
+
<div class="font-medium">Overweight</div>
|
| 154 |
+
<div class="text-xs text-gray-500 dark:text-gray-400">25 - 29.9</div>
|
| 155 |
+
</div>
|
| 156 |
+
<div class="bmi-category" id="obese">
|
| 157 |
+
<div class="font-medium">Obese</div>
|
| 158 |
+
<div class="text-xs text-gray-500 dark:text-gray-400">≥ 30</div>
|
| 159 |
+
</div>
|
| 160 |
+
</div>
|
| 161 |
+
</div>
|
| 162 |
+
|
| 163 |
+
<div class="text-center text-sm text-gray-500 dark:text-gray-400">
|
| 164 |
+
BMI is a simple index of weight-for-height that is commonly used to classify underweight, overweight and obesity in adults.
|
| 165 |
+
</div>
|
| 166 |
+
</div>
|
| 167 |
+
|
| 168 |
+
<script>
|
| 169 |
+
// DOM elements
|
| 170 |
+
const heightInput = document.getElementById('height');
|
| 171 |
+
const weightInput = document.getElementById('weight');
|
| 172 |
+
const bmiValue = document.getElementById('bmi-value');
|
| 173 |
+
const bmiCategoryText = document.getElementById('bmi-category-text');
|
| 174 |
+
const bmiIndicator = document.getElementById('bmi-indicator');
|
| 175 |
+
const underweightEl = document.getElementById('underweight');
|
| 176 |
+
const normalEl = document.getElementById('normal');
|
| 177 |
+
const overweightEl = document.getElementById('overweight');
|
| 178 |
+
const obeseEl = document.getElementById('obese');
|
| 179 |
+
const themeToggle = document.getElementById('theme-toggle');
|
| 180 |
+
|
| 181 |
+
// Initialize
|
| 182 |
+
calculateBMI();
|
| 183 |
+
|
| 184 |
+
// Event listeners
|
| 185 |
+
heightInput.addEventListener('input', calculateBMI);
|
| 186 |
+
weightInput.addEventListener('input', calculateBMI);
|
| 187 |
+
|
| 188 |
+
themeToggle.addEventListener('click', () => {
|
| 189 |
+
document.documentElement.classList.toggle('dark');
|
| 190 |
+
localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light');
|
| 191 |
+
});
|
| 192 |
+
|
| 193 |
+
// Check for saved theme preference
|
| 194 |
+
if (localStorage.getItem('theme') === 'dark' ||
|
| 195 |
+
(!localStorage.getItem('theme') && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
| 196 |
+
document.documentElement.classList.add('dark');
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
// Calculate BMI and update UI
|
| 200 |
+
function calculateBMI() {
|
| 201 |
+
const height = parseFloat(heightInput.value) / 100; // Convert cm to m
|
| 202 |
+
const weight = parseFloat(weightInput.value);
|
| 203 |
+
|
| 204 |
+
if (height <= 0 || weight <= 0) return;
|
| 205 |
+
|
| 206 |
+
const bmi = weight / (height * height);
|
| 207 |
+
const roundedBMI = Math.round(bmi * 10) / 10;
|
| 208 |
+
|
| 209 |
+
bmiValue.textContent = roundedBMI;
|
| 210 |
+
|
| 211 |
+
// Position indicator on the bar (BMI range: 15 to 40)
|
| 212 |
+
const position = Math.min(Math.max((bmi - 15) / (40 - 15), 0), 1);
|
| 213 |
+
bmiIndicator.style.top = `${100 - (position * 100)}%`;
|
| 214 |
+
|
| 215 |
+
// Update category text and styling
|
| 216 |
+
let category = '';
|
| 217 |
+
let categoryEl = null;
|
| 218 |
+
let isHealthy = false;
|
| 219 |
+
|
| 220 |
+
if (bmi < 18.5) {
|
| 221 |
+
category = 'Underweight';
|
| 222 |
+
categoryEl = underweightEl;
|
| 223 |
+
} else if (bmi >= 18.5 && bmi < 25) {
|
| 224 |
+
category = 'Normal weight';
|
| 225 |
+
categoryEl = normalEl;
|
| 226 |
+
isHealthy = true;
|
| 227 |
+
} else if (bmi >= 25 && bmi < 30) {
|
| 228 |
+
category = 'Overweight';
|
| 229 |
+
categoryEl = overweightEl;
|
| 230 |
+
} else {
|
| 231 |
+
category = 'Obese';
|
| 232 |
+
categoryEl = obeseEl;
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
bmiCategoryText.textContent = category;
|
| 236 |
+
|
| 237 |
+
// Reset all categories
|
| 238 |
+
[underweightEl, normalEl, overweightEl, obeseEl].forEach(el => {
|
| 239 |
+
el.classList.remove('active');
|
| 240 |
+
el.classList.remove('celebrate');
|
| 241 |
+
});
|
| 242 |
+
|
| 243 |
+
// Highlight current category
|
| 244 |
+
if (categoryEl) {
|
| 245 |
+
categoryEl.classList.add('active');
|
| 246 |
+
|
| 247 |
+
// Celebrate if in healthy range
|
| 248 |
+
if (isHealthy) {
|
| 249 |
+
categoryEl.classList.add('celebrate');
|
| 250 |
+
triggerConfetti();
|
| 251 |
+
}
|
| 252 |
+
}
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
// Trigger confetti effect
|
| 256 |
+
function triggerConfetti() {
|
| 257 |
+
const end = Date.now() + 1000;
|
| 258 |
+
const colors = ['#06b6d4', '#10b981', '#0ea5e9', '#8b5cf6'];
|
| 259 |
+
|
| 260 |
+
(function frame() {
|
| 261 |
+
confetti({
|
| 262 |
+
particleCount: 4,
|
| 263 |
+
angle: 60,
|
| 264 |
+
spread: 55,
|
| 265 |
+
origin: { x: 0, y: 0.7 },
|
| 266 |
+
colors: colors
|
| 267 |
+
});
|
| 268 |
+
confetti({
|
| 269 |
+
particleCount: 4,
|
| 270 |
+
angle: 120,
|
| 271 |
+
spread: 55,
|
| 272 |
+
origin: { x: 1, y: 0.7 },
|
| 273 |
+
colors: colors
|
| 274 |
+
});
|
| 275 |
+
|
| 276 |
+
if (Date.now() < end) {
|
| 277 |
+
requestAnimationFrame(frame);
|
| 278 |
+
}
|
| 279 |
+
}());
|
| 280 |
+
}
|
| 281 |
+
</script>
|
| 282 |
+
<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=sourcingnuances/vitality-bmi" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 283 |
+
</html>
|
prompts.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
You are a senior front-end engineer. Build a single-page Unit Converter that: 1. Lets the user pick a measurement category (Length, Weight, Temp, Volume) from a `<select>`. 2. Dynamically fills two unit `<select>` boxes for “From” and “To”. 3. Converts on input in real time—no submit button. 4. After each conversion, calls OpenAI /v1/chat/completions (gpt-4o) with: “Explain one practical scenario where converting {{FROM}} → {{TO}} is useful, max 25 words.” 5. Shows the fun fact under the result. 6. Store `OPENAI_API_KEY` in `const OPENAI_API_KEY` at top. 7. CSS: neat flex layout, dark/light toggle via CSS variables. Return full HTML with inline `<style>` and `<script>`—nothing external.
|
| 2 |
+
Craft a fitness-inspired BMI Calculator featuring a vertical color bar that shifts from cool teal to warm coral according to the result. Incorporate large circular input dials, soft shadow layering, and a celebratory confetti burst when the ideal range is reached.
|