-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
317 lines (271 loc) · 16 KB
/
index.html
File metadata and controls
317 lines (271 loc) · 16 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>IntiCheck - AI Healthcare Assistant</title>
<link rel="manifest" href="manifest.json">
<meta name="theme-color" content="#a3e635">
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap" rel="stylesheet">
<style>
:root {
--primary-bg: #0f3f38;
--secondary-bg: #1c6158;
--accent-green: #a3e635;
--accent-hover: #84cc16;
--danger: #ef4444;
--text-main: #ffffff;
--text-muted: rgba(255, 255, 255, 0.7);
--glass-bg: rgba(255, 255, 255, 0.08);
--glass-border: rgba(255, 255, 255, 0.2);
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Outfit', sans-serif; }
body {
background: linear-gradient(135deg, var(--primary-bg) 0%, var(--secondary-bg) 100%);
color: var(--text-main);
min-height: 100vh;
overflow-x: hidden;
-webkit-font-smoothing: antialiased;
}
/* --- NAVIGATION --- */
header {
display: flex; justify-content: space-between; align-items: center;
padding: 20px 5%; background: rgba(0, 0, 0, 0.1);
backdrop-filter: blur(10px); border-bottom: 1px solid var(--glass-border);
}
.logo { font-size: 24px; font-weight: 700; color: white; text-decoration: none; letter-spacing: -1px; }
nav a { color: var(--text-muted); text-decoration: none; margin: 0 15px; transition: 0.3s; font-size: 15px; }
nav a.active, nav a:hover { color: var(--accent-green); font-weight: 600; }
/* --- HERO SECTION --- */
.hero {
display: flex; justify-content: space-between; align-items: flex-start;
padding: 60px 5%; max-width: 1400px; margin: 0 auto; flex-wrap: wrap; gap: 40px;
}
.hero-text { flex: 1; min-width: 300px; }
.hero-text h1 { font-size: 56px; line-height: 1.1; margin-bottom: 20px; }
.hero-text h1 span { color: var(--accent-green); }
.hero-text p { color: var(--text-muted); font-size: 18px; margin-bottom: 30px; max-width: 85%; }
/* --- FAQ Accordion Component --- */
.faq-section { margin-top: 50px; max-width: 85%; }
.faq-item { border-bottom: 1px solid var(--glass-border); padding: 15px 0; cursor: pointer; }
.faq-question { font-weight: 600; display: flex; justify-content: space-between; color: var(--accent-green); font-size: 15px; }
.faq-answer { display: none; margin-top: 10px; font-size: 14px; color: var(--text-muted); line-height: 1.5; }
/* --- AI ANALYSIS INTERFACE (Glassmorphism) --- */
.app-glass-card {
flex: 1; min-width: 350px; max-width: 450px;
background: var(--glass-bg); backdrop-filter: blur(16px);
border: 1px solid var(--glass-border); border-radius: 24px;
padding: 30px; box-shadow: 0 25px 50px rgba(0,0,0,0.3); position: relative;
}
/* Decorative Background Glow */
.app-glass-card::before {
content: ''; position: absolute; top: -30px; left: -30px;
width: 100px; height: 100px; background: var(--accent-green);
border-radius: 50%; filter: blur(40px); z-index: -1; opacity: 0.3;
}
.upload-area {
border: 2px dashed rgba(255,255,255,0.4); border-radius: 16px;
padding: 40px 20px; text-align: center; cursor: pointer;
transition: all 0.3s ease; background: rgba(0,0,0,0.1);
}
.upload-area:hover { border-color: var(--accent-green); background: rgba(163, 230, 53, 0.05); }
#file-input { display: none; }
#image-preview {
width: 100%; height: 240px; object-fit: cover;
border-radius: 12px; display: none; margin-bottom: 20px;
border: 1px solid var(--glass-border);
}
.photo-guidelines { background: rgba(0,0,0,0.2); padding: 15px; border-radius: 12px; margin-top: 15px; font-size: 13px; color: var(--text-muted); }
.photo-guidelines ul { margin-left: 20px; margin-top: 5px; }
.legal-check { display: flex; align-items: flex-start; gap: 10px; margin: 20px 0; font-size: 13px; color: var(--text-muted); }
.legal-check input { margin-top: 3px; accent-color: var(--accent-green); transform: scale(1.2); cursor: pointer; }
.btn-primary {
background: var(--accent-green); color: #000; border: none; padding: 15px 30px;
border-radius: 30px; font-weight: 700; font-size: 15px; width: 100%;
cursor: pointer; transition: 0.3s; text-transform: uppercase; letter-spacing: 0.5px;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-2px); }
.btn-primary:disabled { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.3); cursor: not-allowed; }
#loader { display: none; text-align: center; margin: 15px 0; font-weight: 600; color: var(--accent-green); }
#error-box { display: none; background: rgba(239, 68, 68, 0.15); border-left: 4px solid var(--danger); padding: 15px; border-radius: 12px; margin-top: 15px; }
/* --- RESULTS VIEW --- */
#results { display: none; margin-top: 20px; animation: fadeIn 0.5s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.info-box { background: rgba(0,0,0,0.2); padding: 15px; border-radius: 12px; margin-bottom: 15px; font-size: 14px; }
.info-box h4 { margin-bottom: 5px; color: var(--text-main); font-size: 13px; text-transform: uppercase; }
.info-box p { color: var(--text-muted); line-height: 1.5; }
.map-link {
display: inline-block; margin-top: 12px; background: rgba(255,255,255,0.05);
border: 1px solid var(--accent-green); color: var(--accent-green);
padding: 12px 20px; border-radius: 20px; text-decoration: none;
font-size: 13px; transition: 0.3s; text-align: center; width: 100%; font-weight: 600;
}
.map-link:hover { background: var(--accent-green); color: black; }
/* --- MOBILE OPTIMIZATION --- */
@media (max-width: 768px) {
.hero { flex-direction: column; align-items: center; padding: 30px 5%; }
.hero-text { text-align: center; margin-bottom: 20px; }
.hero-text h1 { font-size: 42px; }
.hero-text p { max-width: 100%; }
.app-glass-card { width: 100%; max-width: 400px; min-width: unset; margin: 0 auto; }
.scroll-indicator { display: flex; flex-direction: column; align-items: center; margin-bottom: 30px; animation: bounce 2s infinite; }
}
@keyframes bounce { 0%, 20%, 50%, 80%, 100% { transform: translateY(0); } 40% { transform: translateY(-10px); } }
</style>
</head>
<body>
<header>
<a href="#" class="logo">IntiCheck.</a>
<nav>
<a href="index.html" class="active">Analyzer</a>
<a href="about.html">About Project</a>
</nav>
</header>
<section class="hero">
<div class="hero-text">
<h1>Smarter Diagnostics Starts with <span>IntiCheck.</span></h1>
<p>A discreet AI-powered assistant that analyzes skin lesions in seconds. Stop relying on search engines; let Artificial Intelligence provide a preliminary clinical assessment.</p>
<div class="faq-section">
<h3 style="margin-bottom: 15px; font-size: 18px;">Common Questions:</h3>
<div class="faq-item" onclick="toggleFaq(this)">
<div class="faq-question">Are my photos stored anywhere? <span>+</span></div>
<div class="faq-answer">No. Our system processes images in-memory and destroys the data immediately after generating the results. We maintain a zero-disk retention policy for user privacy.</div>
</div>
<div class="faq-item" onclick="toggleFaq(this)">
<div class="faq-question">Is the AI diagnosis 100% accurate? <span>+</span></div>
<div class="faq-answer">No. This application is a clinical triage prototype. It provides a statistical classification and should always be verified by a licensed medical professional.</div>
</div>
</div>
</div>
<div class="app-glass-card">
<div class="upload-area" id="drop-zone" onclick="document.getElementById('file-input').click()">
<div style="font-size: 32px; margin-bottom: 10px;">📸</div>
<span id="upload-text">Click here or drop a skin lesion photo</span>
<input type="file" id="file-input" accept="image/*" capture="environment">
</div>
<img id="image-preview" src="" alt="Capture Preview">
<div class="photo-guidelines" id="guidelines">
<strong>How to capture a proper photo?</strong>
<ul>
<li>Focus closely on the lesion (avoid full limbs).</li>
<li>Ensure the image is sharp and well-focused.</li>
<li>Use natural lighting and avoid using flash.</li>
</ul>
</div>
<div class="legal-check">
<input type="checkbox" id="legal-checkbox">
<label for="legal-checkbox">I understand that this AI assessment is preliminary and does not replace professional medical advice.</label>
</div>
<button id="analyze-btn" class="btn-primary" disabled>Start AI Analysis</button>
<div id="loader">Processing Image... ⚙️</div>
<div id="error-box">
<h4 style="color: #fca5a5; margin-bottom: 5px;">⚠️ Connectivity Issue</h4>
<p id="error-text" style="color: #fecaca; font-size: 13px;"></p>
</div>
<div id="results">
<div class="info-box" style="background: rgba(163, 230, 53, 0.15); border: 1px solid var(--accent-green);">
<h3 id="res-category" style="color: var(--accent-green); margin-bottom: 5px;">Category</h3>
<p style="font-size: 12px;">Algorithm Confidence: <span id="res-confidence">0</span>%</p>
</div>
<div class="info-box"><h4>💡 Clinical Description</h4><p id="res-description"></p></div>
<div class="info-box"><h4>🩹 Immediate Actions</h4><p id="res-first-aid"></p></div>
<div class="info-box" style="border-left: 4px solid var(--accent-green);">
<h4>Recommended Specialist</h4>
<p id="res-specialist" style="color: #fff; font-weight: 600;"></p>
<a id="res-map-link" href="#" target="_blank" class="map-link">📍 Find a specialist nearby</a>
</div>
</div>
</div>
</section>
<script>
// --- PWA SERVICE WORKER REGISTRATION ---
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/sw.js').catch(err => console.error('PWA Registration failed:', err));
});
}
const fileInput = document.getElementById('file-input');
const imagePreview = document.getElementById('image-preview');
const analyzeBtn = document.getElementById('analyze-btn');
const dropZone = document.getElementById('drop-zone');
const resultsDiv = document.getElementById('results');
const loader = document.getElementById('loader');
const errorBox = document.getElementById('error-box');
const legalCheck = document.getElementById('legal-checkbox');
let selectedFile = null;
function checkState() {
analyzeBtn.disabled = !(selectedFile && legalCheck.checked);
}
legalCheck.addEventListener('change', checkState);
fileInput.addEventListener('change', function(event) {
const file = event.target.files[0];
if (file) {
selectedFile = file;
const reader = new FileReader();
reader.onload = function(e) {
imagePreview.src = e.target.result;
imagePreview.style.display = 'block';
dropZone.style.display = 'none';
document.getElementById('guidelines').style.display = 'none';
resultsDiv.style.display = 'none';
errorBox.style.display = 'none';
checkState();
}
reader.readAsDataURL(file);
}
});
analyzeBtn.addEventListener('click', async function() {
if (!selectedFile || !legalCheck.checked) return;
analyzeBtn.disabled = true;
analyzeBtn.innerText = 'Analyzing...';
loader.style.display = 'block';
resultsDiv.style.display = 'none';
errorBox.style.display = 'none';
const formData = new FormData();
formData.append('image', selectedFile);
try {
// Request directed to local/hosted Flask API
const response = await fetch('/predict', {
method: 'POST',
body: formData
});
const data = await response.json();
if (response.ok) {
// Update DOM using the new English JSON keys from server.py
document.getElementById('res-category').innerText = data.category;
document.getElementById('res-confidence').innerText = data.confidence;
document.getElementById('res-description').innerText = data.description;
document.getElementById('res-first-aid').innerText = data.first_aid;
document.getElementById('res-specialist').innerText = data.specialist;
// Dynamic Google Maps Search Integration
let searchTerms = data.specialist.replace(/👨⚕️|🚨|Urgent: /g, '').split(' or ')[0].trim();
let mapsUrl = `https://www.google.com/maps/search/${encodeURIComponent(searchTerms + ' near me')}`;
document.getElementById('res-map-link').href = mapsUrl;
resultsDiv.style.display = 'block';
} else {
document.getElementById('error-text').innerText = data.error || "An unexpected error occurred during analysis.";
errorBox.style.display = 'block';
}
} catch (error) {
document.getElementById('error-text').innerText = "Unable to connect to IntiCheck AI cloud. Please check your internet connection.";
errorBox.style.display = 'block';
} finally {
analyzeBtn.disabled = false;
analyzeBtn.innerText = 'Analyze Another Image';
loader.style.display = 'none';
// UI Reset Logic
analyzeBtn.onclick = function() {
location.reload(); // Simple reload to clear state for next use
};
}
});
function toggleFaq(element) {
const answer = element.querySelector('.faq-answer');
const sign = element.querySelector('.faq-question span');
const isVisible = answer.style.display === 'block';
answer.style.display = isVisible ? 'none' : 'block';
sign.innerText = isVisible ? '+' : '-';
}
</script>
</body>
</html>