mnm-matin commited on
Commit
0f4797c
·
verified ·
1 Parent(s): d715b8a

Fix geospatial demo startup on published HyperView

Browse files
.hyperview/extensions/geospatial-readout/panel.js CHANGED
@@ -26,9 +26,6 @@ const colors = {
26
  candidate: "#34d399",
27
  faint: "#1e293b",
28
  error: "#fca5a5",
29
- warningBg: "#3b2f12",
30
- warningBorder: "#92400e",
31
- warningText: "#fde68a",
32
  };
33
 
34
  function prettyLabel(label) {
@@ -483,7 +480,6 @@ export default function GeospatialComparisonPanel() {
483
 
484
  const models = React.useMemo(() => normalizeModels(panelProps.models), [panelProps.models]);
485
  const examples = Array.isArray(panelProps.examples) ? panelProps.examples : [];
486
- const warnings = Array.isArray(panelProps.warnings) ? panelProps.warnings.filter(Boolean) : [];
487
  const datasetLabel = String(panelProps.datasetLabel || "NWPU-RESISC45");
488
  const sampleCount = typeof panelProps.sampleCount === "number" ? panelProps.sampleCount : samplesState.totalSamples;
489
  const classCount = typeof panelProps.classCount === "number" ? panelProps.classCount : null;
@@ -560,23 +556,6 @@ export default function GeospatialComparisonPanel() {
560
  { title: "What to do" },
561
  React.createElement(Walkthrough, null),
562
  ),
563
- warnings.length
564
- ? React.createElement(
565
- "div",
566
- {
567
- style: {
568
- border: `1px solid ${colors.warningBorder}`,
569
- borderRadius: 4,
570
- background: colors.warningBg,
571
- color: colors.warningText,
572
- padding: 8,
573
- fontSize: 11,
574
- lineHeight: 1.35,
575
- },
576
- },
577
- warnings[0],
578
- )
579
- : null,
580
  React.createElement(
581
  Section,
582
  { title: "Queries to inspect" },
 
26
  candidate: "#34d399",
27
  faint: "#1e293b",
28
  error: "#fca5a5",
 
 
 
29
  };
30
 
31
  function prettyLabel(label) {
 
480
 
481
  const models = React.useMemo(() => normalizeModels(panelProps.models), [panelProps.models]);
482
  const examples = Array.isArray(panelProps.examples) ? panelProps.examples : [];
 
483
  const datasetLabel = String(panelProps.datasetLabel || "NWPU-RESISC45");
484
  const sampleCount = typeof panelProps.sampleCount === "number" ? panelProps.sampleCount : samplesState.totalSamples;
485
  const classCount = typeof panelProps.classCount === "number" ? panelProps.classCount : null;
 
556
  { title: "What to do" },
557
  React.createElement(Walkthrough, null),
558
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
559
  React.createElement(
560
  Section,
561
  { title: "Queries to inspect" },
demo.py CHANGED
@@ -285,10 +285,22 @@ def add_geospatial_samples(dataset: hv.Dataset) -> None:
285
  }
286
  )
287
 
288
- upserted, skipped_existing = dataset.add_images(
289
- image_rows,
 
 
 
 
 
 
 
 
 
 
 
290
  skip_existing=not FORCE_SAMPLE_REFRESH,
291
  )
 
292
  updated = (
293
  sum(1 for row in image_rows if str(row["sample_id"]) in existing_ids)
294
  if FORCE_SAMPLE_REFRESH
 
285
  }
286
  )
287
 
288
+ samples = [
289
+ Sample(
290
+ id=str(row["sample_id"]),
291
+ filepath=row["filepath"],
292
+ label=row["label"],
293
+ metadata=row["metadata"],
294
+ )
295
+ for row in image_rows
296
+ if FORCE_SAMPLE_REFRESH or str(row["sample_id"]) not in existing_ids
297
+ ]
298
+ skipped_existing = 0 if FORCE_SAMPLE_REFRESH else len(image_rows) - len(samples)
299
+ upserted, add_samples_skipped = dataset.add_samples(
300
+ samples,
301
  skip_existing=not FORCE_SAMPLE_REFRESH,
302
  )
303
+ skipped_existing += add_samples_skipped
304
  updated = (
305
  sum(1 for row in image_rows if str(row["sample_id"]) in existing_ids)
306
  if FORCE_SAMPLE_REFRESH