Spaces:
Runtime error
Runtime error
File size: 10,891 Bytes
de00503 2331697 de00503 2331697 de00503 2331697 de00503 5194035 9b7ba2e de00503 2331697 5194035 2331697 5194035 2331697 5194035 2331697 | 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 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>RetiCheck | AI Diagnosis Portal</title>
<link rel="manifest" href="/static/manifest.json">
<meta name="theme-color" content="#38bdf8">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; }
body {
background: radial-gradient(circle at top left, #1e293b, #0f172a);
min-height: 100vh;
color: white;
display: flex; flex-direction: column; align-items: center; justify-content: center;
padding: 30px;
}
.header { text-align: center; margin-bottom: 30px; animation: fadeInDown 1s ease; }
.logo { font-size: 36px; font-weight: 800; letter-spacing: 1px; }
.logo span { background: linear-gradient(90deg, #00f2fe, #4facfe); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.subtitle { color: #94a3b8; font-size: 16px; margin-top: 5px; }
.glass-card {
background: rgba(255, 255, 255, 0.03);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 30px;
padding: 50px 40px;
width: 100%;
max-width: 550px;
text-align: center;
box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
animation: fadeInUp 1s ease;
}
.upload-zone {
width: 100%;
height: 320px;
background: rgba(0,0,0,0.2);
border-radius: 25px;
margin-bottom: 30px;
position: relative;
overflow: hidden;
border: 2px dashed #334155;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
transition: all 0.3s ease;
}
.upload-zone:hover {
border-color: #00f2fe;
background: rgba(0, 242, 254, 0.05);
transform: translateY(-5px);
}
.upload-placeholder {
text-align: center;
transition: 0.3s;
}
.upload-icon {
font-size: 60px;
color: #00f2fe;
margin-bottom: 20px;
animation: float 3s ease-in-out infinite;
}
.upload-text { color: #cbd5e1; font-size: 18px; font-weight: 600; }
.upload-subtext { color: #64748b; font-size: 14px; margin-top: 8px; }
#preview-img {
width: 100%; height: 100%; object-fit: cover; display: none; border-radius: 25px;
}
.scan-line {
position: absolute; top: 0; width: 100%; height: 4px;
background: #00f2fe; box-shadow: 0 0 30px #00f2fe, 0 0 10px #00f2fe;
display: none; z-index: 5;
}
@keyframes scanning { 0% { top: 0; opacity: 0; } 50% { opacity: 1; } 100% { top: 100%; opacity: 0; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
.analyze-btn {
width: 100%;
padding: 20px;
background: linear-gradient(90deg, #00f2fe, #4facfe);
color: #0f172a;
border: none;
border-radius: 15px;
font-size: 18px;
font-weight: 800;
letter-spacing: 1px;
cursor: pointer;
box-shadow: 0 10px 30px -10px rgba(0, 242, 254, 0.5);
transition: 0.3s;
display: flex; justify-content: center; align-items: center; gap: 10px;
}
.analyze-btn:hover { transform: translateY(-3px); box-shadow: 0 15px 35px -10px rgba(0, 242, 254, 0.6); }
.analyze-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }
.loading-container { display: none; margin-top: 30px; }
.progress-bar { background: #1e293b; height: 8px; border-radius: 10px; margin-top: 15px; overflow: hidden; position: relative; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #00f2fe, #4facfe); transition: width 0.2s ease-in-out; border-radius: 10px; }
.status-text-container { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; }
</style>
</head>
<body>
<div class="header">
<div class="logo">RetiCheck <span>AI</span></div>
<p class="subtitle">Advanced Retinal Disease Screening Portal</p>
</div>
<div class="glass-card">
<label for="fileInput" class="upload-zone" id="dropZone">
<div id="scan-line" class="scan-line"></div>
<div class="upload-placeholder" id="placeholderContent">
<i class="fa-solid fa-cloud-arrow-up upload-icon"></i>
<p class="upload-text">Click to Upload Retinal Scan</p>
<p class="upload-subtext">Supports JPG, PNG (Max 10MB)</p>
</div>
<img id="preview-img">
</label>
<input type="file" id="fileInput" style="display: none;" accept="image/*" onchange="previewFile()">
<button class="analyze-btn" id="analyzeBtn" onclick="runFullAnalysis()">
<i class="fa-solid fa-microchip"></i> START AI DIAGNOSIS
</button>
<button class="analyze-btn" style="background: #1e293b; color: #00f2fe; margin-top: 15px;" onclick="openDatabase()">
<i class="fa-solid fa-lock"></i> VIEW PATIENT DATABASE
</button>
<div class="loading-container" id="loadingArea">
<div class="status-text-container">
<span style="color: #00f2fe;">Processing Image...</span>
<span id="progressPercent" style="color: #94a3b8;">0%</span>
</div>
<div class="progress-bar">
<div class="progress-fill" id="pFill"></div>
</div>
</div>
</div>
<script>
const previewImg = document.getElementById('preview-img');
const placeholderContent = document.getElementById('placeholderContent');
const dropZone = document.getElementById('dropZone');
const scanLine = document.getElementById('scan-line');
const pFill = document.getElementById('pFill');
const progressPercent = document.getElementById('progressPercent');
const loadingArea = document.getElementById('loadingArea');
const analyzeBtn = document.getElementById('analyzeBtn');
const fileInput = document.getElementById('fileInput');
function previewFile() {
const file = fileInput.files[0];
if (!file) return;
const reader = new FileReader();
reader.onloadend = () => {
placeholderContent.style.display = 'none';
previewImg.style.display = 'block';
previewImg.src = reader.result;
dropZone.style.borderColor = '#00f2fe';
dropZone.style.boxShadow = '0 0 20px rgba(0, 242, 254, 0.2)';
}
reader.readAsDataURL(file);
}
async function runFullAnalysis() {
if (!fileInput.files.length) {
alert("⚠️ Please upload a retinal scan image first.");
dropZone.style.animation = 'shake 0.5s';
setTimeout(() => dropZone.style.animation = '', 500);
return;
}
loadingArea.style.display = 'block';
scanLine.style.display = 'block';
scanLine.style.animation = 'scanning 1.5s infinite ease-in-out';
analyzeBtn.innerHTML = '<i class="fa-solid fa-circle-notch fa-spin"></i> Analyzing...';
analyzeBtn.disabled = true;
dropZone.style.pointerEvents = 'none';
let progress = 0;
let progressInterval = setInterval(() => {
if(progress < 95) {
progress += Math.floor(Math.random() * 5) + 1;
if(progress > 95) progress = 95;
pFill.style.width = progress + "%";
progressPercent.innerText = progress + "%";
}
}, 150);
const formData = new FormData();
formData.append('image', fileInput.files[0]);
try {
let response = await fetch('/predict', { method: 'POST', body: formData });
let data = await response.json();
localStorage.setItem('aiResult', JSON.stringify(data));
clearInterval(progressInterval);
pFill.style.width = "100%";
progressPercent.innerText = "100% - Complete";
setTimeout(() => { window.location.href = "/result"; }, 800);
} catch (error) {
clearInterval(progressInterval);
alert("❌ Error connecting to AI Server! Is Flask running?");
analyzeBtn.innerHTML = '<i class="fa-solid fa-microchip"></i> START AI DIAGNOSIS';
analyzeBtn.disabled = false;
loadingArea.style.display = 'none';
scanLine.style.display = 'none';
dropZone.style.pointerEvents = 'auto';
}
}
// --- PUDHU CODE: செக்யூரிட்டி லாக் மேஜிக் 👇 ---
function openDatabase() {
// ஒரு பாக்ஸ் வந்து PIN கேட்கும்
let pin = prompt("🔒 SECURE ACCESS\n\nPlease enter the Doctor's PIN to view patient records:");
// PIN கரெக்ட்டா 1234 னு இருந்தா உள்ளே போகும்
if (pin === "1234") {
window.location.href = '/database';
}
// தப்பா இருந்தா எரர் காட்டும்
else if (pin !== null && pin !== "") {
alert("❌ Incorrect PIN! Access Denied.");
}
}
// --- PUDHU CODE END 👆 ---
</script>
<style>
@keyframes shake { 0% { transform: translateX(0); } 25% { transform: translateX(-10px); } 50% { transform: translateX(10px); } 75% { transform: translateX(-10px); } 100% { transform: translateX(0); } }
</style>
</body>
</html> |