feng-x commited on
Commit
dfaa32e
·
verified ·
1 Parent(s): e17df6f

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. measure_finger.py +16 -16
  2. web_demo/static/app.js +11 -2
measure_finger.py CHANGED
@@ -442,22 +442,22 @@ def _overlay_card_seeds(
442
  for pt in _xform(seeds).astype(int):
443
  _plus(pt, KEEP_COLOR)
444
 
445
- negatives = seed_debug.get("negatives") or []
446
- if negatives:
447
- for pt in _xform(negatives).astype(int):
448
- _plus(pt, NEG_COLOR)
449
-
450
- anchor = seed_debug.get("anchor")
451
- if anchor is not None:
452
- ax, ay = _xform([anchor])[0].astype(int)
453
- # Tilted cross (X) to distinguish the anchor from the plus-shaped seeds.
454
- cv2.drawMarker(
455
- out, (int(ax), int(ay)), ANCHOR_COLOR,
456
- markerType=cv2.MARKER_TILTED_CROSS,
457
- markerSize=marker_size,
458
- thickness=thickness,
459
- line_type=cv2.LINE_AA,
460
- )
461
  return out
462
 
463
 
 
442
  for pt in _xform(seeds).astype(int):
443
  _plus(pt, KEEP_COLOR)
444
 
445
+ #negatives = seed_debug.get("negatives") or []
446
+ #if negatives:
447
+ # for pt in _xform(negatives).astype(int):
448
+ # _plus(pt, NEG_COLOR)
449
+
450
+ #anchor = seed_debug.get("anchor")
451
+ #if anchor is not None:
452
+ # ax, ay = _xform([anchor])[0].astype(int)
453
+ # # Tilted cross (X) to distinguish the anchor from the plus-shaped seeds.
454
+ # cv2.drawMarker(
455
+ # out, (int(ax), int(ay)), ANCHOR_COLOR,
456
+ # markerType=cv2.MARKER_TILTED_CROSS,
457
+ # markerSize=marker_size,
458
+ # thickness=thickness,
459
+ # line_type=cv2.LINE_AA,
460
+ # )
461
  return out
462
 
463
 
web_demo/static/app.js CHANGED
@@ -243,10 +243,16 @@ const renderSingleResult = (result) => {
243
  };
244
 
245
  const runMeasurement = async (endpoint, formData, inputUrlFallback = "") => {
246
- setStatus("Measuring… Please wait 5-10 seconds.");
 
 
 
 
 
 
247
  jsonOutput.textContent = '{\n "status": "processing"\n}';
248
- overallSize.innerHTML = `<div class="size-hero"><span class="size-label">Measuring…</span></div>`;
249
  fingerBreakdown.innerHTML = "";
 
250
 
251
  try {
252
  const response = await fetch(endpoint, {
@@ -255,10 +261,12 @@ const runMeasurement = async (endpoint, formData, inputUrlFallback = "") => {
255
  });
256
 
257
  if (!response.ok) {
 
258
  const error = await response.json();
259
  setStatus(error.error || "Measurement failed", { error: true });
260
  return;
261
  }
 
262
 
263
  const data = await response.json();
264
  jsonOutput.textContent = JSON.stringify(data.result, null, 2);
@@ -280,6 +288,7 @@ const runMeasurement = async (endpoint, formData, inputUrlFallback = "") => {
280
  setStatus(formatFailReasonStatus(failReason), { error: true });
281
  }
282
  } catch (error) {
 
283
  setStatus("Network error. Please retry.", { error: true });
284
  }
285
  };
 
243
  };
244
 
245
  const runMeasurement = async (endpoint, formData, inputUrlFallback = "") => {
246
+ const startedAt = Date.now();
247
+ const renderElapsed = () => {
248
+ const secs = Math.floor((Date.now() - startedAt) / 1000);
249
+ setStatus(`Measuring… Please wait. (${secs}s)`);
250
+ overallSize.innerHTML = `<div class="size-hero"><span class="size-label">Measuring… ${secs}s</span></div>`;
251
+ };
252
+ renderElapsed();
253
  jsonOutput.textContent = '{\n "status": "processing"\n}';
 
254
  fingerBreakdown.innerHTML = "";
255
+ const timerId = setInterval(renderElapsed, 1000);
256
 
257
  try {
258
  const response = await fetch(endpoint, {
 
261
  });
262
 
263
  if (!response.ok) {
264
+ clearInterval(timerId);
265
  const error = await response.json();
266
  setStatus(error.error || "Measurement failed", { error: true });
267
  return;
268
  }
269
+ clearInterval(timerId);
270
 
271
  const data = await response.json();
272
  jsonOutput.textContent = JSON.stringify(data.result, null, 2);
 
288
  setStatus(formatFailReasonStatus(failReason), { error: true });
289
  }
290
  } catch (error) {
291
+ clearInterval(timerId);
292
  setStatus("Network error. Please retry.", { error: true });
293
  }
294
  };