Spaces:
Sleeping
Sleeping
Fix mobile: responsive cards, rear camera, scroll
Browse files
app.py
CHANGED
|
@@ -280,14 +280,32 @@ CUSTOM_CSS = """
|
|
| 280 |
@keyframes medvision-spin {
|
| 281 |
to { transform: rotate(360deg); }
|
| 282 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 283 |
"""
|
| 284 |
|
| 285 |
SCROLL_JS = """
|
| 286 |
<script>
|
|
|
|
| 287 |
document.addEventListener('click', function(e) {
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
setTimeout(function() { window.scrollTo({top: 0, behavior: 'smooth'}); }, 300);
|
| 291 |
}
|
| 292 |
});
|
| 293 |
</script>
|
|
@@ -309,8 +327,10 @@ with demo:
|
|
| 309 |
type="pil",
|
| 310 |
label="Upload Chest X-ray",
|
| 311 |
sources=["upload", "webcam"],
|
| 312 |
-
|
| 313 |
-
|
|
|
|
|
|
|
| 314 |
)
|
| 315 |
language_input = gr.Dropdown(
|
| 316 |
choices=list(LANGUAGES.keys()),
|
|
@@ -334,15 +354,18 @@ with demo:
|
|
| 334 |
outputs=[raw_output, findings_output, protocol_output, translated_output],
|
| 335 |
)
|
| 336 |
|
| 337 |
-
gr.
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
|
|
|
|
|
|
|
|
|
| 346 |
""")
|
| 347 |
|
| 348 |
gr.Examples(
|
|
|
|
| 280 |
@keyframes medvision-spin {
|
| 281 |
to { transform: rotate(360deg); }
|
| 282 |
}
|
| 283 |
+
/* Responsive expected results cards */
|
| 284 |
+
.expected-results .card-grid {
|
| 285 |
+
display: grid;
|
| 286 |
+
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
|
| 287 |
+
gap: 8px;
|
| 288 |
+
margin: 8px 0;
|
| 289 |
+
}
|
| 290 |
+
.expected-results .card {
|
| 291 |
+
background: var(--block-background-fill);
|
| 292 |
+
border: 1px solid var(--block-border-color);
|
| 293 |
+
border-radius: 8px;
|
| 294 |
+
padding: 10px;
|
| 295 |
+
font-size: 0.85em;
|
| 296 |
+
}
|
| 297 |
+
.expected-results .card strong {
|
| 298 |
+
display: block;
|
| 299 |
+
margin-bottom: 4px;
|
| 300 |
+
}
|
| 301 |
"""
|
| 302 |
|
| 303 |
SCROLL_JS = """
|
| 304 |
<script>
|
| 305 |
+
// Scroll to top when an example is clicked
|
| 306 |
document.addEventListener('click', function(e) {
|
| 307 |
+
if (e.target.closest('.gallery, .examples')) {
|
| 308 |
+
setTimeout(function() { window.scrollTo({top: 0, behavior: 'smooth'}); }, 500);
|
|
|
|
| 309 |
}
|
| 310 |
});
|
| 311 |
</script>
|
|
|
|
| 327 |
type="pil",
|
| 328 |
label="Upload Chest X-ray",
|
| 329 |
sources=["upload", "webcam"],
|
| 330 |
+
webcam_options=gr.WebcamOptions(
|
| 331 |
+
mirror=False,
|
| 332 |
+
constraints={"facingMode": "environment"},
|
| 333 |
+
),
|
| 334 |
)
|
| 335 |
language_input = gr.Dropdown(
|
| 336 |
choices=list(LANGUAGES.keys()),
|
|
|
|
| 354 |
outputs=[raw_output, findings_output, protocol_output, translated_output],
|
| 355 |
)
|
| 356 |
|
| 357 |
+
gr.HTML("""
|
| 358 |
+
<div class="expected-results">
|
| 359 |
+
<h3>Example chest X-rays β Expected results</h3>
|
| 360 |
+
<p style="font-size:0.85em;color:var(--body-text-color-subdued);">CheXpert test set, radiologist-verified</p>
|
| 361 |
+
<div class="card-grid">
|
| 362 |
+
<div class="card"><strong>1. Normal</strong>All clear β no pathology detected</div>
|
| 363 |
+
<div class="card"><strong>2. Cardiomegaly</strong>Cardiomegaly: DETECTED</div>
|
| 364 |
+
<div class="card"><strong>3. Effusion</strong>Effusion: DETECTED</div>
|
| 365 |
+
<div class="card"><strong>4. Edema</strong>Edema: DETECTED</div>
|
| 366 |
+
<div class="card"><strong>5. Multiple</strong>Pneumonia: DETECTED<br>Consolidation: DETECTED<br>Effusion: DETECTED</div>
|
| 367 |
+
</div>
|
| 368 |
+
</div>
|
| 369 |
""")
|
| 370 |
|
| 371 |
gr.Examples(
|