Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,7 +32,7 @@ MODELS = {
|
|
| 32 |
},
|
| 33 |
"fracture": {
|
| 34 |
"type": "image",
|
| 35 |
-
"id": "nickmuchi/vit-finetuned-chest-xray-pneumonia",
|
| 36 |
"desc": "Bone Trauma X-Ray",
|
| 37 |
"safe": ["NORMAL", "normal", "No Pneumonia"],
|
| 38 |
"rules": {"max_sat": 30, "reject_msg": "❌ Invalid: Too colorful. Please upload a B&W X-Ray."}
|
|
@@ -191,12 +191,9 @@ def home():
|
|
| 191 |
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
|
| 192 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 193 |
<style>
|
| 194 |
-
/* Modern Gradient & Glassmorphism */
|
| 195 |
body { background: #f8fafc; background-image: radial-gradient(#cbd5e1 1px, transparent 1px); background-size: 24px 24px; }
|
| 196 |
.glass-header { background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(255,255,255,0.5); }
|
| 197 |
.glass-card { background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, 0.5); box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07); }
|
| 198 |
-
|
| 199 |
-
/* Button Styling - The "Sticker" Effect */
|
| 200 |
.icon-btn { transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); background: rgba(255,255,255,0.8); backdrop-filter: blur(5px); }
|
| 201 |
.icon-btn:hover { transform: translateY(-5px) scale(1.05); box-shadow: 0 15px 30px -5px rgba(59, 130, 246, 0.15); border-color: #93c5fd; }
|
| 202 |
.icon-btn.active { background: #eff6ff; border-color: #3b82f6; box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15); transform: scale(0.98); }
|
|
@@ -222,7 +219,7 @@ def home():
|
|
| 222 |
</div>
|
| 223 |
</div>
|
| 224 |
<div class="flex flex-col items-end gap-2">
|
| 225 |
-
<select id="lang-select" onchange="changeLanguage()" class="bg-
|
| 226 |
<option value="en">🇬🇧 English</option>
|
| 227 |
<option value="hi">🇮🇳 हिंदी (Hindi)</option>
|
| 228 |
<option value="as">🇮🇳 অসমীয়া (Assamese)</option>
|
|
@@ -264,7 +261,6 @@ def home():
|
|
| 264 |
</div>
|
| 265 |
|
| 266 |
<div class="glass-card rounded-3xl overflow-hidden relative">
|
| 267 |
-
|
| 268 |
<div id="scope-box" class="hidden bg-slate-50/50 border-b border-slate-100 p-3 text-center backdrop-blur-sm">
|
| 269 |
<p class="text-[10px] font-bold text-slate-400 uppercase tracking-wider mb-2" data-translate="lbl_scope">Scope of Detection</p>
|
| 270 |
<div id="scope-tags" class="flex flex-wrap justify-center gap-2"></div>
|
|
@@ -287,7 +283,6 @@ def home():
|
|
| 287 |
|
| 288 |
<div onclick="document.getElementById('file-input').click()" class="border-2 border-dashed border-slate-300 rounded-2xl p-10 text-center cursor-pointer hover:bg-blue-50/50 hover:border-blue-400 transition-all duration-300 group relative overflow-hidden bg-white/60">
|
| 289 |
<input type="file" id="file-input" class="hidden" onchange="showPreview(event)" onclick="this.value=null">
|
| 290 |
-
|
| 291 |
<div id="placeholder" class="group-hover:scale-105 transition-transform duration-300">
|
| 292 |
<div class="w-20 h-20 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-4 text-blue-600 shadow-sm">
|
| 293 |
<i id="upload-icon" class="fas fa-cloud-upload-alt text-3xl"></i>
|
|
@@ -295,7 +290,6 @@ def home():
|
|
| 295 |
<p id="upload-text" class="text-slate-600 font-bold" data-translate="txt_upload">Tap to upload</p>
|
| 296 |
<p class="text-xs text-slate-400 mt-1">Supported: JPG, PNG, WAV, MP3</p>
|
| 297 |
</div>
|
| 298 |
-
|
| 299 |
<div class="relative z-10">
|
| 300 |
<img id="img-preview" class="hidden mx-auto max-h-64 rounded-xl shadow-lg object-contain bg-black/5">
|
| 301 |
<audio id="audio-preview" controls class="hidden w-full mt-4"></audio>
|
|
@@ -303,7 +297,7 @@ def home():
|
|
| 303 |
</div>
|
| 304 |
</div>
|
| 305 |
|
| 306 |
-
<button id="run-btn" onclick="analyze()" class="hidden w-full max-w-md mx-auto bg-gradient-to-r from-blue-600 to-indigo-700 hover:from-blue-700 hover:to-indigo-800 text-white font-bold py-4 rounded-xl shadow-lg shadow-blue-200 transition-all transform hover:scale-[1.02] flex items-center justify-center gap-3">
|
| 307 |
<i class="fas fa-microscope text-xl"></i> <span class="text-lg" data-translate="btn_run">Run Diagnosis</span>
|
| 308 |
</button>
|
| 309 |
|
|
@@ -562,18 +556,18 @@ def home():
|
|
| 562 |
}
|
| 563 |
}
|
| 564 |
|
| 565 |
-
// FIND NEAREST DOCTOR (
|
| 566 |
function findDoctor() {
|
| 567 |
if (navigator.geolocation) {
|
| 568 |
navigator.geolocation.getCurrentPosition((pos) => {
|
| 569 |
let lat = pos.coords.latitude;
|
| 570 |
let lon = pos.coords.longitude;
|
| 571 |
-
window.open(`
|
| 572 |
}, () => {
|
| 573 |
-
window.open('https://www.google.com/maps/search/
|
| 574 |
});
|
| 575 |
} else {
|
| 576 |
-
window.open('https://www.google.com/maps/search/
|
| 577 |
}
|
| 578 |
}
|
| 579 |
|
|
|
|
| 32 |
},
|
| 33 |
"fracture": {
|
| 34 |
"type": "image",
|
| 35 |
+
"id": "nickmuchi/vit-finetuned-chest-xray-pneumonia",
|
| 36 |
"desc": "Bone Trauma X-Ray",
|
| 37 |
"safe": ["NORMAL", "normal", "No Pneumonia"],
|
| 38 |
"rules": {"max_sat": 30, "reject_msg": "❌ Invalid: Too colorful. Please upload a B&W X-Ray."}
|
|
|
|
| 191 |
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
|
| 192 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 193 |
<style>
|
|
|
|
| 194 |
body { background: #f8fafc; background-image: radial-gradient(#cbd5e1 1px, transparent 1px); background-size: 24px 24px; }
|
| 195 |
.glass-header { background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(255,255,255,0.5); }
|
| 196 |
.glass-card { background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, 0.5); box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07); }
|
|
|
|
|
|
|
| 197 |
.icon-btn { transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); background: rgba(255,255,255,0.8); backdrop-filter: blur(5px); }
|
| 198 |
.icon-btn:hover { transform: translateY(-5px) scale(1.05); box-shadow: 0 15px 30px -5px rgba(59, 130, 246, 0.15); border-color: #93c5fd; }
|
| 199 |
.icon-btn.active { background: #eff6ff; border-color: #3b82f6; box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15); transform: scale(0.98); }
|
|
|
|
| 219 |
</div>
|
| 220 |
</div>
|
| 221 |
<div class="flex flex-col items-end gap-2">
|
| 222 |
+
<select id="lang-select" onchange="changeLanguage()" class="bg-slate-100 border border-slate-200 text-slate-700 text-xs rounded-lg focus:ring-blue-500 focus:border-blue-500 block p-1.5 shadow-sm outline-none">
|
| 223 |
<option value="en">🇬🇧 English</option>
|
| 224 |
<option value="hi">🇮🇳 हिंदी (Hindi)</option>
|
| 225 |
<option value="as">🇮🇳 অসমীয়া (Assamese)</option>
|
|
|
|
| 261 |
</div>
|
| 262 |
|
| 263 |
<div class="glass-card rounded-3xl overflow-hidden relative">
|
|
|
|
| 264 |
<div id="scope-box" class="hidden bg-slate-50/50 border-b border-slate-100 p-3 text-center backdrop-blur-sm">
|
| 265 |
<p class="text-[10px] font-bold text-slate-400 uppercase tracking-wider mb-2" data-translate="lbl_scope">Scope of Detection</p>
|
| 266 |
<div id="scope-tags" class="flex flex-wrap justify-center gap-2"></div>
|
|
|
|
| 283 |
|
| 284 |
<div onclick="document.getElementById('file-input').click()" class="border-2 border-dashed border-slate-300 rounded-2xl p-10 text-center cursor-pointer hover:bg-blue-50/50 hover:border-blue-400 transition-all duration-300 group relative overflow-hidden bg-white/60">
|
| 285 |
<input type="file" id="file-input" class="hidden" onchange="showPreview(event)" onclick="this.value=null">
|
|
|
|
| 286 |
<div id="placeholder" class="group-hover:scale-105 transition-transform duration-300">
|
| 287 |
<div class="w-20 h-20 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-4 text-blue-600 shadow-sm">
|
| 288 |
<i id="upload-icon" class="fas fa-cloud-upload-alt text-3xl"></i>
|
|
|
|
| 290 |
<p id="upload-text" class="text-slate-600 font-bold" data-translate="txt_upload">Tap to upload</p>
|
| 291 |
<p class="text-xs text-slate-400 mt-1">Supported: JPG, PNG, WAV, MP3</p>
|
| 292 |
</div>
|
|
|
|
| 293 |
<div class="relative z-10">
|
| 294 |
<img id="img-preview" class="hidden mx-auto max-h-64 rounded-xl shadow-lg object-contain bg-black/5">
|
| 295 |
<audio id="audio-preview" controls class="hidden w-full mt-4"></audio>
|
|
|
|
| 297 |
</div>
|
| 298 |
</div>
|
| 299 |
|
| 300 |
+
<button id="run-btn" onclick="analyze()" class="hidden w-full max-w-md mx-auto bg-gradient-to-r from-blue-600 to-indigo-700 hover:from-blue-700 hover:to-indigo-800 text-white font-bold py-4 rounded-xl shadow-lg shadow-blue-200 transition-all transform hover:scale-[1.02] flex items-center justify-center gap-3 animate-pulse-soft">
|
| 301 |
<i class="fas fa-microscope text-xl"></i> <span class="text-lg" data-translate="btn_run">Run Diagnosis</span>
|
| 302 |
</button>
|
| 303 |
|
|
|
|
| 556 |
}
|
| 557 |
}
|
| 558 |
|
| 559 |
+
// FIND NEAREST DOCTOR (Corrected URL)
|
| 560 |
function findDoctor() {
|
| 561 |
if (navigator.geolocation) {
|
| 562 |
navigator.geolocation.getCurrentPosition((pos) => {
|
| 563 |
let lat = pos.coords.latitude;
|
| 564 |
let lon = pos.coords.longitude;
|
| 565 |
+
window.open(`https://www.google.com/maps/search/hospitals+near+me/@${lat},${lon},13z`, '_blank');
|
| 566 |
}, () => {
|
| 567 |
+
window.open('https://www.google.com/maps/search/hospitals+near+me', '_blank');
|
| 568 |
});
|
| 569 |
} else {
|
| 570 |
+
window.open('https://www.google.com/maps/search/hospitals+near+me', '_blank');
|
| 571 |
}
|
| 572 |
}
|
| 573 |
|