Spaces:
Sleeping
Sleeping
Update src/templates/index.html
Browse files- src/templates/index.html +137 -118
src/templates/index.html
CHANGED
|
@@ -1,132 +1,151 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
newValue = Math.round(newValue * 1000) / 1000;
|
| 30 |
-
|
| 31 |
-
const clamped = validateAndClamp(newValue);
|
| 32 |
-
input.value = clamped;
|
| 33 |
-
input.dispatchEvent(new Event('input')); // Trigger events
|
| 34 |
-
}
|
| 35 |
-
|
| 36 |
-
// Button Listeners
|
| 37 |
-
decreaseBtn.addEventListener('click', () => updateValue(-1));
|
| 38 |
-
increaseBtn.addEventListener('click', () => updateValue(1));
|
| 39 |
-
|
| 40 |
-
// Validation on Blur (Flash Red if corrected)
|
| 41 |
-
input.addEventListener('blur', function() {
|
| 42 |
-
let current = parseFloat(this.value) || 0;
|
| 43 |
-
const clamped = validateAndClamp(current);
|
| 44 |
-
|
| 45 |
-
if (current !== clamped) {
|
| 46 |
-
this.value = clamped;
|
| 47 |
-
this.style.color = '#f87171';
|
| 48 |
-
setTimeout(() => this.style.color = '#ffffff', 300);
|
| 49 |
-
}
|
| 50 |
-
});
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
|
|
|
| 83 |
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
|
|
|
|
|
|
| 104 |
|
| 105 |
-
|
| 106 |
-
<div class="
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
<
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
<span style="color: #fff; font-weight: bold;">${result.confidence.toFixed(1)}%</span>
|
| 115 |
-
</div>
|
| 116 |
-
<div class="confidence-bar-bg">
|
| 117 |
-
<div class="confidence-bar-fill" style="width: ${result.confidence}%; background-color: ${barColor};"></div>
|
| 118 |
-
</div>
|
| 119 |
</div>
|
|
|
|
| 120 |
</div>
|
| 121 |
-
`;
|
| 122 |
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
submitBtn.style.opacity = "1";
|
| 132 |
-
}
|
|
|
|
| 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, maximum-scale=1.0, user-scalable=no">
|
| 6 |
+
<title>Diabetes Prediction Model</title>
|
| 7 |
+
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
| 8 |
+
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap" rel="stylesheet">
|
| 9 |
+
</head>
|
| 10 |
+
<body>
|
| 11 |
|
| 12 |
+
<div class="container">
|
| 13 |
+
<header>
|
| 14 |
+
<h1>🩺 BetaCell AI</h1>
|
| 15 |
+
<p>Diabetes Risk Prediction Model</p>
|
| 16 |
+
</header>
|
| 17 |
|
| 18 |
+
<div class="main-content">
|
| 19 |
+
|
| 20 |
+
<!-- The Form -->
|
| 21 |
+
<div class="form-section">
|
| 22 |
+
<form id="predictionForm" onsubmit="event.preventDefault(); makePrediction();">
|
| 23 |
+
<div class="form-grid">
|
| 24 |
|
| 25 |
+
<!-- 1. Pregnancies -->
|
| 26 |
+
<div class="input-group">
|
| 27 |
+
<label class="input-label">Pregnancies</label>
|
| 28 |
+
<div class="number-input-container">
|
| 29 |
+
<input type="number" id="Pregnancies" class="number-input" value="3" min="0" max="17" step="1" inputmode="numeric">
|
| 30 |
+
<div class="controls">
|
| 31 |
+
<button class="control-btn decrease-btn" type="button"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M3 8h10" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button>
|
| 32 |
+
<div class="separator"></div>
|
| 33 |
+
<button class="control-btn increase-btn" type="button"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M8 3v10M3 8h10" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button>
|
| 34 |
+
</div>
|
| 35 |
+
</div>
|
| 36 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
+
<!-- 2. Glucose -->
|
| 39 |
+
<div class="input-group">
|
| 40 |
+
<label class="input-label">Glucose (mg/dL)</label>
|
| 41 |
+
<div class="number-input-container">
|
| 42 |
+
<input type="number" id="Glucose" class="number-input" value="117" min="0" max="199" step="1" inputmode="numeric">
|
| 43 |
+
<div class="controls">
|
| 44 |
+
<button class="control-btn decrease-btn" type="button"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M3 8h10" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button>
|
| 45 |
+
<div class="separator"></div>
|
| 46 |
+
<button class="control-btn increase-btn" type="button"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M8 3v10M3 8h10" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button>
|
| 47 |
+
</div>
|
| 48 |
+
</div>
|
| 49 |
+
</div>
|
| 50 |
|
| 51 |
+
<!-- 3. Blood Pressure -->
|
| 52 |
+
<div class="input-group">
|
| 53 |
+
<label class="input-label">Blood Pressure (mm Hg)</label>
|
| 54 |
+
<div class="number-input-container">
|
| 55 |
+
<input type="number" id="BloodPressure" class="number-input" value="72" min="0" max="122" step="1" inputmode="numeric">
|
| 56 |
+
<div class="controls">
|
| 57 |
+
<button class="control-btn decrease-btn" type="button"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M3 8h10" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button>
|
| 58 |
+
<div class="separator"></div>
|
| 59 |
+
<button class="control-btn increase-btn" type="button"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M8 3v10M3 8h10" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button>
|
| 60 |
+
</div>
|
| 61 |
+
</div>
|
| 62 |
+
</div>
|
| 63 |
|
| 64 |
+
<!-- 4. Skin Thickness -->
|
| 65 |
+
<div class="input-group">
|
| 66 |
+
<label class="input-label">Skin Thickness (mm)</label>
|
| 67 |
+
<div class="number-input-container">
|
| 68 |
+
<input type="number" id="SkinThickness" class="number-input" value="23" min="0" max="99" step="1" inputmode="numeric">
|
| 69 |
+
<div class="controls">
|
| 70 |
+
<button class="control-btn decrease-btn" type="button"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M3 8h10" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button>
|
| 71 |
+
<div class="separator"></div>
|
| 72 |
+
<button class="control-btn increase-btn" type="button"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M8 3v10M3 8h10" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button>
|
| 73 |
+
</div>
|
| 74 |
+
</div>
|
| 75 |
+
</div>
|
| 76 |
|
| 77 |
+
<!-- 5. Insulin -->
|
| 78 |
+
<div class="input-group">
|
| 79 |
+
<label class="input-label">Insulin (mu U/ml)</label>
|
| 80 |
+
<div class="number-input-container">
|
| 81 |
+
<input type="number" id="Insulin" class="number-input" value="30" min="0" max="846" step="1" inputmode="numeric">
|
| 82 |
+
<div class="controls">
|
| 83 |
+
<button class="control-btn decrease-btn" type="button"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M3 8h10" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button>
|
| 84 |
+
<div class="separator"></div>
|
| 85 |
+
<button class="control-btn increase-btn" type="button"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M8 3v10M3 8h10" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button>
|
| 86 |
+
</div>
|
| 87 |
+
</div>
|
| 88 |
+
</div>
|
| 89 |
|
| 90 |
+
<!-- 6. BMI -->
|
| 91 |
+
<div class="input-group">
|
| 92 |
+
<label class="input-label">
|
| 93 |
+
<a href="https://www.calculator.net/bmi-calculator.html" target="_blank" class="external-link">BMI</a>
|
| 94 |
+
</label>
|
| 95 |
+
<div class="number-input-container">
|
| 96 |
+
<input type="number" id="BMI" class="number-input" value="32.0" min="0" max="67.1" step="0.1" inputmode="decimal">
|
| 97 |
+
<div class="controls">
|
| 98 |
+
<button class="control-btn decrease-btn" type="button"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M3 8h10" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button>
|
| 99 |
+
<div class="separator"></div>
|
| 100 |
+
<button class="control-btn increase-btn" type="button"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M8 3v10M3 8h10" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button>
|
| 101 |
+
</div>
|
| 102 |
+
</div>
|
| 103 |
+
</div>
|
| 104 |
|
| 105 |
+
<!-- 7. Diabetes Pedigree Function -->
|
| 106 |
+
<div class="input-group">
|
| 107 |
+
<label class="input-label">Diabetes Pedigree</label>
|
| 108 |
+
<div class="number-input-container">
|
| 109 |
+
<input type="number" id="DiabetesPedigreeFunction" class="number-input" value="0.372" min="0.078" max="2.42" step="0.001" inputmode="decimal">
|
| 110 |
+
<div class="controls">
|
| 111 |
+
<button class="control-btn decrease-btn" type="button"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M3 8h10" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button>
|
| 112 |
+
<div class="separator"></div>
|
| 113 |
+
<button class="control-btn increase-btn" type="button"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M8 3v10M3 8h10" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button>
|
| 114 |
+
</div>
|
| 115 |
+
</div>
|
| 116 |
+
</div>
|
| 117 |
|
| 118 |
+
<!-- 8. Age -->
|
| 119 |
+
<div class="input-group">
|
| 120 |
+
<label class="input-label">Age (Years)</label>
|
| 121 |
+
<div class="number-input-container">
|
| 122 |
+
<input type="number" id="Age" class="number-input" value="29" min="21" max="81" step="1" inputmode="numeric">
|
| 123 |
+
<div class="controls">
|
| 124 |
+
<button class="control-btn decrease-btn" type="button"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M3 8h10" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button>
|
| 125 |
+
<div class="separator"></div>
|
| 126 |
+
<button class="control-btn increase-btn" type="button"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M8 3v10M3 8h10" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
</div>
|
| 128 |
+
</div>
|
| 129 |
</div>
|
|
|
|
| 130 |
|
| 131 |
+
</div>
|
| 132 |
+
|
| 133 |
+
<button type="submit" class="submit-btn">Run Prediction</button>
|
| 134 |
+
</form>
|
| 135 |
+
</div>
|
| 136 |
+
|
| 137 |
+
<!-- Results -->
|
| 138 |
+
<div class="result-section" id="resultCard">
|
| 139 |
+
<div class="placeholder-text">
|
| 140 |
+
<div style="font-size: 3rem; margin-bottom: 10px;">⚡</div>
|
| 141 |
+
<h3>Ready to Predict</h3>
|
| 142 |
+
<p>Enter patient vitals and click Run Prediction.</p>
|
| 143 |
+
</div>
|
| 144 |
+
</div>
|
| 145 |
+
|
| 146 |
+
</div>
|
| 147 |
+
</div>
|
| 148 |
|
| 149 |
+
<script src="{{ url_for('static', filename='script.js') }}"></script>
|
| 150 |
+
</body>
|
| 151 |
+
</html>
|
|
|
|
|
|