Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +158 -24
templates/index.html
CHANGED
|
@@ -304,10 +304,22 @@
|
|
| 304 |
background: rgba(0, 0, 0, 0.3);
|
| 305 |
border: 1px solid rgba(148, 163, 184, 0.2);
|
| 306 |
border-radius: 10px;
|
| 307 |
-
overflow:
|
| 308 |
transition: all 0.3s ease;
|
| 309 |
}
|
| 310 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 311 |
.height-group:focus-within {
|
| 312 |
border-color: #3b82f6;
|
| 313 |
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
|
@@ -340,7 +352,7 @@
|
|
| 340 |
font-weight: 600;
|
| 341 |
white-space: nowrap;
|
| 342 |
transition: opacity 0.2s ease;
|
| 343 |
-
border-radius: 0 !important;
|
| 344 |
transform: none !important;
|
| 345 |
}
|
| 346 |
|
|
@@ -372,18 +384,110 @@
|
|
| 372 |
transition: background 0.2s ease, border 0.2s ease, color 0.2s ease;
|
| 373 |
}
|
| 374 |
|
| 375 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 376 |
background: rgba(96, 165, 250, 0.18);
|
| 377 |
border-color: rgba(96, 165, 250, 0.5);
|
| 378 |
color: #bfdbfe;
|
| 379 |
}
|
| 380 |
|
| 381 |
|
| 382 |
-
.gba-height-btn:disabled
|
|
|
|
| 383 |
opacity: 0.4;
|
| 384 |
cursor: not-allowed;
|
| 385 |
}
|
| 386 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 387 |
/* Checkbox styling */
|
| 388 |
.checkbox-row {
|
| 389 |
display: flex;
|
|
@@ -1003,13 +1107,17 @@
|
|
| 1003 |
<label for="height">Building Height</label>
|
| 1004 |
<div class="height-group">
|
| 1005 |
<input type="number" id="height" step="any" value="0" placeholder="5.0">
|
| 1006 |
-
<button type="button" class="
|
| 1007 |
-
data-lon-id="longitude" data-height-id="height"
|
| 1008 |
-
data-
|
|
|
|
|
|
|
| 1009 |
</div>
|
| 1010 |
-
<button type="button" class="
|
| 1011 |
-
data-
|
| 1012 |
-
|
|
|
|
|
|
|
| 1013 |
</button>
|
| 1014 |
<p class="helper-text">
|
| 1015 |
Meters above ground (0 = ground level)
|
|
@@ -1063,10 +1171,19 @@
|
|
| 1063 |
<label for="height2">Building Height</label>
|
| 1064 |
<div class="height-group">
|
| 1065 |
<input type="number" id="height2" step="any" value="0">
|
| 1066 |
-
<button type="button" class="
|
| 1067 |
data-lon-id="longitude2" data-height-id="height2"
|
| 1068 |
-
data-error-id="explained-error"
|
|
|
|
|
|
|
|
|
|
| 1069 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1070 |
<p class="helper-text">Meters above ground</p>
|
| 1071 |
</div>
|
| 1072 |
|
|
@@ -1117,10 +1234,19 @@
|
|
| 1117 |
<label for="height3">Building Height</label>
|
| 1118 |
<div class="height-group">
|
| 1119 |
<input type="number" id="height3" step="any" value="0">
|
| 1120 |
-
<button type="button" class="
|
| 1121 |
data-lon-id="longitude3" data-height-id="height3"
|
| 1122 |
-
data-error-id="multihazard-error"
|
|
|
|
|
|
|
|
|
|
| 1123 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1124 |
<p class="helper-text">Meters above ground</p>
|
| 1125 |
</div>
|
| 1126 |
|
|
@@ -1171,13 +1297,15 @@
|
|
| 1171 |
</div>
|
| 1172 |
</div>
|
| 1173 |
|
| 1174 |
-
<div class="
|
| 1175 |
-
<
|
| 1176 |
-
|
| 1177 |
-
<
|
| 1178 |
-
|
| 1179 |
-
|
| 1180 |
-
|
|
|
|
|
|
|
| 1181 |
</p>
|
| 1182 |
</div>
|
| 1183 |
|
|
@@ -1538,7 +1666,10 @@
|
|
| 1538 |
|
| 1539 |
document.getElementById(heightId).value = Number(h).toFixed(2);
|
| 1540 |
} catch (e) {
|
| 1541 |
-
if (errorBox)
|
|
|
|
|
|
|
|
|
|
| 1542 |
} finally {
|
| 1543 |
button.disabled = false;
|
| 1544 |
button.textContent = originalText;
|
|
@@ -1575,10 +1706,13 @@
|
|
| 1575 |
|
| 1576 |
try {
|
| 1577 |
const mode = document.getElementById('batchMode').value;
|
| 1578 |
-
const
|
| 1579 |
let endpoint = mode === 'multihazard' ? '/assess_batch_multihazard' : '/assess_batch';
|
| 1580 |
|
| 1581 |
-
if (
|
|
|
|
|
|
|
|
|
|
| 1582 |
const sep = endpoint.includes('?') ? '&' : '?';
|
| 1583 |
endpoint = endpoint + sep + 'use_predicted_height=true';
|
| 1584 |
}
|
|
|
|
| 304 |
background: rgba(0, 0, 0, 0.3);
|
| 305 |
border: 1px solid rgba(148, 163, 184, 0.2);
|
| 306 |
border-radius: 10px;
|
| 307 |
+
overflow: visible;
|
| 308 |
transition: all 0.3s ease;
|
| 309 |
}
|
| 310 |
|
| 311 |
+
.height-group input {
|
| 312 |
+
border-radius: 10px 0 0 10px;
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
.height-group button:last-child {
|
| 316 |
+
border-radius: 0 10px 10px 0;
|
| 317 |
+
}
|
| 318 |
+
|
| 319 |
+
.input-card {
|
| 320 |
+
overflow: visible;
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
.height-group:focus-within {
|
| 324 |
border-color: #3b82f6;
|
| 325 |
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
|
|
|
| 352 |
font-weight: 600;
|
| 353 |
white-space: nowrap;
|
| 354 |
transition: opacity 0.2s ease;
|
| 355 |
+
border-radius: 0 10px 10px 0 !important;
|
| 356 |
transform: none !important;
|
| 357 |
}
|
| 358 |
|
|
|
|
| 384 |
transition: background 0.2s ease, border 0.2s ease, color 0.2s ease;
|
| 385 |
}
|
| 386 |
|
| 387 |
+
.secondary-btn-style {
|
| 388 |
+
margin-top: 0.4rem;
|
| 389 |
+
align-self: flex-start;
|
| 390 |
+
|
| 391 |
+
background: rgba(96, 165, 250, 0.08);
|
| 392 |
+
border: 1px solid rgba(96, 165, 250, 0.25);
|
| 393 |
+
border-radius: 8px;
|
| 394 |
+
|
| 395 |
+
padding: 0.25rem 0.6rem;
|
| 396 |
+
font-size: 0.7em;
|
| 397 |
+
font-weight: 500;
|
| 398 |
+
|
| 399 |
+
color: #93c5fd;
|
| 400 |
+
cursor: pointer;
|
| 401 |
+
|
| 402 |
+
transition: background 0.2s ease, border 0.2s ease, color 0.2s ease;
|
| 403 |
+
}
|
| 404 |
+
|
| 405 |
+
.gba-height-btn:hover,
|
| 406 |
+
.secondary-btn-style:hover {
|
| 407 |
background: rgba(96, 165, 250, 0.18);
|
| 408 |
border-color: rgba(96, 165, 250, 0.5);
|
| 409 |
color: #bfdbfe;
|
| 410 |
}
|
| 411 |
|
| 412 |
|
| 413 |
+
.gba-height-btn:disabled,
|
| 414 |
+
.secondary-btn-style:disabled {
|
| 415 |
opacity: 0.4;
|
| 416 |
cursor: not-allowed;
|
| 417 |
}
|
| 418 |
|
| 419 |
+
|
| 420 |
+
.height-group .gba-height-btn {
|
| 421 |
+
margin-top: 0;
|
| 422 |
+
align-self: auto;
|
| 423 |
+
border-radius: 0;
|
| 424 |
+
border-left: 1px solid rgba(148, 163, 184, 0.3);
|
| 425 |
+
height: auto;
|
| 426 |
+
background: linear-gradient(135deg, #3b82f6, #8b5cf6);
|
| 427 |
+
color: white;
|
| 428 |
+
border: none;
|
| 429 |
+
padding: 0.875rem 1.5rem;
|
| 430 |
+
}
|
| 431 |
+
|
| 432 |
+
.height-group .gba-height-btn:hover {
|
| 433 |
+
background: linear-gradient(135deg, #3b82f6, #8b5cf6);
|
| 434 |
+
opacity: 0.9;
|
| 435 |
+
color: white;
|
| 436 |
+
border-color: transparent;
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
/* Custom tooltip styling for buttons */
|
| 440 |
+
.tooltip-btn {
|
| 441 |
+
position: relative;
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
.tooltip-btn::after {
|
| 445 |
+
content: attr(data-tooltip);
|
| 446 |
+
position: absolute;
|
| 447 |
+
bottom: calc(100% + 10px);
|
| 448 |
+
left: 50%;
|
| 449 |
+
transform: translateX(-50%);
|
| 450 |
+
padding: 10px 14px;
|
| 451 |
+
background: rgba(15, 23, 42, 0.95);
|
| 452 |
+
color: #e2e8f0;
|
| 453 |
+
font-size: 1em;
|
| 454 |
+
font-weight: 400;
|
| 455 |
+
border-radius: 8px;
|
| 456 |
+
border: 1px solid rgba(59, 130, 246, 0.3);
|
| 457 |
+
white-space: normal;
|
| 458 |
+
width: max-content;
|
| 459 |
+
max-width: 280px;
|
| 460 |
+
text-align: center;
|
| 461 |
+
opacity: 0;
|
| 462 |
+
visibility: hidden;
|
| 463 |
+
transition: opacity 0.2s ease, visibility 0.2s ease;
|
| 464 |
+
z-index: 1000;
|
| 465 |
+
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
|
| 466 |
+
pointer-events: none;
|
| 467 |
+
line-height: 1.4;
|
| 468 |
+
}
|
| 469 |
+
|
| 470 |
+
.tooltip-btn::before {
|
| 471 |
+
content: '';
|
| 472 |
+
position: absolute;
|
| 473 |
+
bottom: calc(100% + 2px);
|
| 474 |
+
left: 50%;
|
| 475 |
+
transform: translateX(-50%);
|
| 476 |
+
border-width: 8px;
|
| 477 |
+
border-style: solid;
|
| 478 |
+
border-color: rgba(15, 23, 42, 0.95) transparent transparent transparent;
|
| 479 |
+
opacity: 0;
|
| 480 |
+
visibility: hidden;
|
| 481 |
+
transition: opacity 0.2s ease, visibility 0.2s ease;
|
| 482 |
+
z-index: 1001;
|
| 483 |
+
}
|
| 484 |
+
|
| 485 |
+
.tooltip-btn:hover::after,
|
| 486 |
+
.tooltip-btn:hover::before {
|
| 487 |
+
opacity: 1;
|
| 488 |
+
visibility: visible;
|
| 489 |
+
}
|
| 490 |
+
|
| 491 |
/* Checkbox styling */
|
| 492 |
.checkbox-row {
|
| 493 |
display: flex;
|
|
|
|
| 1107 |
<label for="height">Building Height</label>
|
| 1108 |
<div class="height-group">
|
| 1109 |
<input type="number" id="height" step="any" value="0" placeholder="5.0">
|
| 1110 |
+
<button type="button" class="gba-height-btn tooltip-btn" data-lat-id="latitude"
|
| 1111 |
+
data-lon-id="longitude" data-height-id="height" data-error-id="basic-error"
|
| 1112 |
+
data-tooltip="The height is from Global Buildings Atlas.">
|
| 1113 |
+
Get Height (GBA)
|
| 1114 |
+
</button>
|
| 1115 |
</div>
|
| 1116 |
+
<button type="button" class="predict-height-btn secondary-btn-style tooltip-btn"
|
| 1117 |
+
data-lat-id="latitude" data-lon-id="longitude" data-height-id="height"
|
| 1118 |
+
data-error-id="basic-error"
|
| 1119 |
+
data-tooltip="Uses the DL model to predict the building height, trained on Barcelona, Paris, Astana, and Vienna.">
|
| 1120 |
+
Predict Height
|
| 1121 |
</button>
|
| 1122 |
<p class="helper-text">
|
| 1123 |
Meters above ground (0 = ground level)
|
|
|
|
| 1171 |
<label for="height2">Building Height</label>
|
| 1172 |
<div class="height-group">
|
| 1173 |
<input type="number" id="height2" step="any" value="0">
|
| 1174 |
+
<button type="button" class="gba-height-btn tooltip-btn" data-lat-id="latitude2"
|
| 1175 |
data-lon-id="longitude2" data-height-id="height2"
|
| 1176 |
+
data-error-id="explained-error"
|
| 1177 |
+
data-tooltip="The height is from Global Buildings Atlas.">
|
| 1178 |
+
Get Height (GBA)
|
| 1179 |
+
</button>
|
| 1180 |
</div>
|
| 1181 |
+
<button type="button" class="predict-height-btn secondary-btn-style tooltip-btn"
|
| 1182 |
+
data-lat-id="latitude2" data-lon-id="longitude2" data-height-id="height2"
|
| 1183 |
+
data-error-id="explained-error"
|
| 1184 |
+
data-tooltip="Uses the DL model to predict the building height, trained on Barcelona, Paris, Astana, and Vienna.">
|
| 1185 |
+
Predict Height
|
| 1186 |
+
</button>
|
| 1187 |
<p class="helper-text">Meters above ground</p>
|
| 1188 |
</div>
|
| 1189 |
|
|
|
|
| 1234 |
<label for="height3">Building Height</label>
|
| 1235 |
<div class="height-group">
|
| 1236 |
<input type="number" id="height3" step="any" value="0">
|
| 1237 |
+
<button type="button" class="gba-height-btn tooltip-btn" data-lat-id="latitude3"
|
| 1238 |
data-lon-id="longitude3" data-height-id="height3"
|
| 1239 |
+
data-error-id="multihazard-error"
|
| 1240 |
+
data-tooltip="The height is from Global Buildings Atlas.">
|
| 1241 |
+
Get Height (GBA)
|
| 1242 |
+
</button>
|
| 1243 |
</div>
|
| 1244 |
+
<button type="button" class="predict-height-btn secondary-btn-style tooltip-btn"
|
| 1245 |
+
data-lat-id="latitude3" data-lon-id="longitude3" data-height-id="height3"
|
| 1246 |
+
data-error-id="multihazard-error"
|
| 1247 |
+
data-tooltip="Uses the DL model to predict the building height, trained on Barcelona, Paris, Astana, and Vienna.">
|
| 1248 |
+
Predict Height
|
| 1249 |
+
</button>
|
| 1250 |
<p class="helper-text">Meters above ground</p>
|
| 1251 |
</div>
|
| 1252 |
|
|
|
|
| 1297 |
</div>
|
| 1298 |
</div>
|
| 1299 |
|
| 1300 |
+
<div class="input-card" style="margin-top: 1.5rem;">
|
| 1301 |
+
<label for="heightSource">Building Height Source</label>
|
| 1302 |
+
<select id="heightSource">
|
| 1303 |
+
<option value="csv">Use height from CSV (default)</option>
|
| 1304 |
+
<option value="gba">Use height from Global Buildings Atlas (GBA)</option>
|
| 1305 |
+
<option value="predicted">Use DL-predicted building height</option>
|
| 1306 |
+
</select>
|
| 1307 |
+
<p class="helper-text">
|
| 1308 |
+
Choose how to obtain building height for each row in the vulnerability assessment.
|
| 1309 |
</p>
|
| 1310 |
</div>
|
| 1311 |
|
|
|
|
| 1666 |
|
| 1667 |
document.getElementById(heightId).value = Number(h).toFixed(2);
|
| 1668 |
} catch (e) {
|
| 1669 |
+
if (errorBox) {
|
| 1670 |
+
errorBox.textContent = String(e.message || e);
|
| 1671 |
+
errorBox.style.display = 'block';
|
| 1672 |
+
}
|
| 1673 |
} finally {
|
| 1674 |
button.disabled = false;
|
| 1675 |
button.textContent = originalText;
|
|
|
|
| 1706 |
|
| 1707 |
try {
|
| 1708 |
const mode = document.getElementById('batchMode').value;
|
| 1709 |
+
const heightSource = document.getElementById('heightSource').value;
|
| 1710 |
let endpoint = mode === 'multihazard' ? '/assess_batch_multihazard' : '/assess_batch';
|
| 1711 |
|
| 1712 |
+
if (heightSource === 'gba') {
|
| 1713 |
+
const sep = endpoint.includes('?') ? '&' : '?';
|
| 1714 |
+
endpoint = endpoint + sep + 'use_gba_height=true';
|
| 1715 |
+
} else if (heightSource === 'predicted') {
|
| 1716 |
const sep = endpoint.includes('?') ? '&' : '?';
|
| 1717 |
endpoint = endpoint + sep + 'use_predicted_height=true';
|
| 1718 |
}
|