feng-x commited on
Commit
ed2b0a1
·
verified ·
1 Parent(s): 6f3fe10

Upload folder using huggingface_hub

Browse files
measure_finger.py CHANGED
@@ -609,7 +609,7 @@ def measure_finger(
609
  card_result = detect_credit_card(image_canonical, debug_dir=card_debug_dir)
610
 
611
  if card_result is None:
612
- logger.warning("credit card not detected in image")
613
  return create_output(
614
  card_detected=False,
615
  fail_reason="card_not_detected",
 
609
  card_result = detect_credit_card(image_canonical, debug_dir=card_debug_dir)
610
 
611
  if card_result is None:
612
+ logger.warning("card not detected in image")
613
  return create_output(
614
  card_detected=False,
615
  fail_reason="card_not_detected",
web_demo/static/app.js CHANGED
@@ -15,7 +15,7 @@ const fingerBreakdown = document.getElementById("fingerBreakdown");
15
  const defaultSampleUrl = window.DEFAULT_SAMPLE_URL || "";
16
  const failReasonMessageMap = {
17
  card_not_detected:
18
- "Credit card not detected. Place the card beside your hand on a plain, white background (e.g. a sheet of paper), and turn on your phone's flash.",
19
  card_not_parallel:
20
  "Card is not parallel to the camera. Keep your phone directly above and parallel to the card.",
21
  card_near_edge:
@@ -128,23 +128,10 @@ const renderMultiResult = (result) => {
128
  return;
129
  }
130
 
131
- const aiExplanation = result.ai_explanation;
132
-
133
- // Always show deterministic recommendation as hero
134
- if (result.overall_best_size) {
135
- overallSize.innerHTML = `
136
- <div class="size-hero">
137
- <span class="size-label">Recommended Size</span>
138
- <span class="size-number">${result.overall_best_size}</span>
139
- <span class="size-range">Range: ${result.overall_range_min} – ${result.overall_range_max}</span>
140
- ${aiExplanation ? `<p class="ai-reason">${aiExplanation}</p>` : ""}
141
- </div>`;
142
- } else {
143
- overallSize.innerHTML = `<div class="size-hero"><span class="size-label">Measurement Failed</span></div>`;
144
- }
145
 
146
  // Per-finger cards: size + range + width
147
- const fingerNames = { index: "Index", middle: "Middle", ring: "Ring" };
148
  const fingerColors = { index: "#00dddd", middle: "#00cc44", ring: "#dd44dd" };
149
  let html = '<div class="finger-cards">';
150
  for (const [fn, label] of Object.entries(fingerNames)) {
@@ -160,9 +147,9 @@ const renderMultiResult = (result) => {
160
  html += `<div class="finger-size-label">Size</div>`;
161
  html += `<div class="finger-size">${size}</div>`;
162
  if (range) {
163
- html += `<div class="finger-range">${range[0]} – ${range[1]}</div>`;
164
  }
165
- html += `<div class="finger-width">${(pf.diameter_cm * 10).toFixed(1)} mm</div>`;
166
  } else {
167
  html += `<div class="finger-failed">Failed</div>
168
  <div class="finger-fail-reason">${pf.fail_reason || "unknown"}</div>`;
@@ -282,7 +269,7 @@ const runMeasurement = async (endpoint, formData, inputUrlFallback = "") => {
282
  }
283
 
284
  if (data.success) {
285
- setStatus("Measurement complete. Results updated.");
286
  } else {
287
  const failReason = data?.result?.fail_reason;
288
  setStatus(formatFailReasonStatus(failReason), { error: true });
 
15
  const defaultSampleUrl = window.DEFAULT_SAMPLE_URL || "";
16
  const failReasonMessageMap = {
17
  card_not_detected:
18
+ "Card not detected. Place the card beside your hand on a plain, white background (e.g. a sheet of paper), and turn on your phone's flash.",
19
  card_not_parallel:
20
  "Card is not parallel to the camera. Keep your phone directly above and parallel to the card.",
21
  card_near_edge:
 
128
  return;
129
  }
130
 
131
+ overallSize.innerHTML = "";
 
 
 
 
 
 
 
 
 
 
 
 
 
132
 
133
  // Per-finger cards: size + range + width
134
+ const fingerNames = { index: "Index (Recommended)", middle: "Middle", ring: "Ring" };
135
  const fingerColors = { index: "#00dddd", middle: "#00cc44", ring: "#dd44dd" };
136
  let html = '<div class="finger-cards">';
137
  for (const [fn, label] of Object.entries(fingerNames)) {
 
147
  html += `<div class="finger-size-label">Size</div>`;
148
  html += `<div class="finger-size">${size}</div>`;
149
  if (range) {
150
+ html += `<div class="finger-range">Range: ${range[0]} – ${range[1]}</div>`;
151
  }
152
+ html += `<div class="finger-width">Width: ${(pf.diameter_cm * 10).toFixed(1)} mm</div>`;
153
  } else {
154
  html += `<div class="finger-failed">Failed</div>
155
  <div class="finger-fail-reason">${pf.fail_reason || "unknown"}</div>`;
 
269
  }
270
 
271
  if (data.success) {
272
+ setStatus("Measurement complete. (Tip: Turning on the camera flash improves accuracy.)");
273
  } else {
274
  const failReason = data?.result?.fail_reason;
275
  setStatus(formatFailReasonStatus(failReason), { error: true });
web_demo/static/styles.css CHANGED
@@ -395,7 +395,7 @@ pre {
395
  }
396
 
397
  .finger-card .finger-range {
398
- font-size: 0.8rem;
399
  color: var(--ink-soft);
400
  margin-top: 2px;
401
  }
 
395
  }
396
 
397
  .finger-card .finger-range {
398
+ font-size: 0.85rem;
399
  color: var(--ink-soft);
400
  margin-top: 2px;
401
  }