Spaces:
Runtime error
Runtime error
adds error treat
Browse files- static/help-proof.js +12 -5
static/help-proof.js
CHANGED
|
@@ -69,12 +69,19 @@
|
|
| 69 |
if (data.error) {
|
| 70 |
verifiedBadge.style.background = 'rgba(220,53,69,0.85)';
|
| 71 |
verifiedText.textContent = 'No animal detected in photo';
|
| 72 |
-
} else if (data.similar && data.similar.some(s => s.id === helpProofAnimalId && s.score_pct >= 60)) {
|
| 73 |
-
verifiedBadge.style.background = 'rgba(56,140,89,0.9)';
|
| 74 |
-
verifiedText.textContent = 'Same animal confirmed ✓';
|
| 75 |
} else {
|
| 76 |
-
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
}
|
| 79 |
} catch(err) {
|
| 80 |
console.warn('AI verify failed:', err);
|
|
|
|
| 69 |
if (data.error) {
|
| 70 |
verifiedBadge.style.background = 'rgba(220,53,69,0.85)';
|
| 71 |
verifiedText.textContent = 'No animal detected in photo';
|
|
|
|
|
|
|
|
|
|
| 72 |
} else {
|
| 73 |
+
const match = data.similar && data.similar.find(s => s.id === helpProofAnimalId);
|
| 74 |
+
const score = match ? match.score_pct : 0;
|
| 75 |
+
if (score >= 60) {
|
| 76 |
+
verifiedBadge.style.background = 'rgba(56,140,89,0.9)';
|
| 77 |
+
verifiedText.textContent = 'Same animal confirmed';
|
| 78 |
+
} else if (score >= 35) {
|
| 79 |
+
verifiedBadge.style.background = 'rgba(56,140,89,0.75)';
|
| 80 |
+
verifiedText.textContent = 'Likely the same animal';
|
| 81 |
+
} else {
|
| 82 |
+
verifiedBadge.style.background = 'rgba(180,130,0,0.85)';
|
| 83 |
+
verifiedText.textContent = 'Photo added — animal not matched';
|
| 84 |
+
}
|
| 85 |
}
|
| 86 |
} catch(err) {
|
| 87 |
console.warn('AI verify failed:', err);
|