Add a structured authenticity signal with a distinct banner, instead of burying it in card_note
The Charizard grade that prompted this had the model writing 'possible non-standard/proxy print' directly into card_note -- the only free-text field available -- since there was nowhere else for that observation to go. That's why it got no visual treatment: the UI renders card_note as a plain grey subtitle, identical to any ordinary card name. Added authenticity as its own top-level field (flag: none/worth_checking/ likely_not_genuine, plus an observation) alongside the four grading categories but explicitly separate from them -- this is about whether the card is a genuine product at all, not its condition, and PSA authenticates before it grades, so a flagged card's estimated_grade goes to null rather than a number. Prompted with concrete tells for both classes of concern: fan-made/proxy prints (fictional sets, non-existent number combos, home-printer texture, 'proxy' watermarks) and counterfeits of real cards (colour/font/holo mismatches against genuine copies). Trimming (already covered under CORNERS from an earlier fix) now also sets this field when flagged, so the UI has one place to check regardless of which specific issue triggered it. UI: a full banner (not a hint line) above the slab -- critical red for likely_not_genuine, warning amber for worth_checking -- plus a matching dot next to the card name in History so it's visible without opening the card. Both colours reuse --critical/--warning rather than the brand red, since this is exactly the 'distrust this' signal those are already reserved for. Migration tested against the live schema shape; existing rows get authenticity=None and render with no banner, as before.
This commit is contained in:
parent
d026cce91a
commit
2b3bbaf40f
5 changed files with 148 additions and 12 deletions
80
vision.py
80
vision.py
|
|
@ -521,6 +521,51 @@ the untouched crop too.
|
|||
On chrome and refractor stock, expect fine scratching; it is the norm rather \
|
||||
than the exception, and its absence is what is notable.
|
||||
|
||||
AUTHENTICITY — separate from all four categories above, and separate from \
|
||||
condition entirely. A pristine card that isn't a genuine product doesn't get \
|
||||
a PSA grade at all; PSA authenticates before it grades, and a card that fails \
|
||||
that step never reaches the 1-10 scale regardless of how clean it looks. \
|
||||
Judge this from what's actually visible, the same discipline as everything \
|
||||
else here — flag it when you see a real, specific tell, not as a hedge.
|
||||
Signs the card may not be an official print at all: a set, era, or \
|
||||
name/number combination that doesn't correspond to any real printing you \
|
||||
recognize; card text in a font, layout, or language inconsistent with the \
|
||||
publisher and era it's claiming to be; artwork that reads as fan-made or \
|
||||
AI-generated rather than the actual official illustration for that card; \
|
||||
visible printing quality far below what mass-produced card stock looks like \
|
||||
— soft/pixelated detail, visible inkjet or laser-printer banding, a paper \
|
||||
stock that looks like cardstock from a home printer rather than the glossy, \
|
||||
consistent stock real trading cards use; or the word "proxy," "custom," \
|
||||
"fan art," or similar printed anywhere on the card itself.
|
||||
Signs a real card might be a counterfeit of a genuine printing: colour \
|
||||
saturation, font weight, or line quality that doesn't match known genuine \
|
||||
copies of that exact card; a holo or foil pattern that looks wrong for the \
|
||||
set (wrong pattern entirely, or applied where the real printing doesn't have \
|
||||
one); a cardback design, layout, or copyright text that doesn't match the \
|
||||
genuine card. Weigh these against your own uncertainty — you're comparing \
|
||||
against a memory of what genuine copies look like, not a reference image, so \
|
||||
reserve likely_not_genuine for cases where something is clearly, specifically \
|
||||
wrong, not just "this looks a little different than I'd expect."
|
||||
TRIMMING is the physical-alteration version of this same concern, already \
|
||||
covered under CORNERS above — a genuine card that's been cut down to fake \
|
||||
sharper edges than it actually has. When you flag trimming there, also set \
|
||||
this field (worth_checking is usually right, since a photo can't confirm it \
|
||||
the way calipers can) so it surfaces in one place rather than only inside a \
|
||||
corners observation.
|
||||
flag "none" is the ordinary case and should be the overwhelming majority \
|
||||
of cards — most cards people photograph for grading are exactly what they \
|
||||
appear to be, and reaching for suspicion without a specific tell is its own \
|
||||
kind of dishonesty, the same failure as inventing wear that isn't there. Use \
|
||||
"worth_checking" when you see something specific but can't be confident from \
|
||||
a photo alone — say what you saw. Use "likely_not_genuine" only when you're \
|
||||
reasonably confident, not just uneasy — a fictional set name, visible \
|
||||
"proxy" text, or artwork that plainly isn't the real official print are the \
|
||||
kind of thing that earns this level; a card that's merely unfamiliar to you \
|
||||
does not.
|
||||
If you flag likely_not_genuine, say so in note and reflect it in the grade: \
|
||||
estimated_grade should be null (this isn't a card PSA would assign a number \
|
||||
to at all), with the reasoning in note rather than in a numeric range.
|
||||
|
||||
HOW PSA COMBINES THE FOUR
|
||||
|
||||
The grade is capped by the WORST attribute, not averaged across them. Three \
|
||||
|
|
@ -670,6 +715,25 @@ GRADE_CATEGORY_SCHEMA = {
|
|||
"additionalProperties": False,
|
||||
}
|
||||
|
||||
AUTHENTICITY_SCHEMA = {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"flag": {
|
||||
"type": "string",
|
||||
"enum": ["none", "worth_checking", "likely_not_genuine"],
|
||||
"description": "Whether anything about this card's legitimacy, "
|
||||
"not its condition, is in question.",
|
||||
},
|
||||
"observation": {
|
||||
"type": "string",
|
||||
"description": "The specific thing that prompted the flag — "
|
||||
"empty string when flag is 'none'.",
|
||||
},
|
||||
},
|
||||
"required": ["flag", "observation"],
|
||||
"additionalProperties": False,
|
||||
}
|
||||
|
||||
GRADING_SCHEMA = {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
@ -682,6 +746,7 @@ GRADING_SCHEMA = {
|
|||
"type": "string",
|
||||
"description": "One line naming the card if legible (player/name, set, year) — for the history list.",
|
||||
},
|
||||
"authenticity": AUTHENTICITY_SCHEMA,
|
||||
"estimated_grade": {
|
||||
"type": ["integer", "null"],
|
||||
"description": "Best single estimate, whole number 1-10, or null if ungradeable from these photos.",
|
||||
|
|
@ -699,9 +764,9 @@ GRADING_SCHEMA = {
|
|||
},
|
||||
"note": {"type": "string", "description": "Short overall summary."},
|
||||
},
|
||||
"required": ["card_type", "card_note", "estimated_grade", "grade_low",
|
||||
"grade_high", "confidence", "centering", "corners", "edges",
|
||||
"surface", "limitations", "note"],
|
||||
"required": ["card_type", "card_note", "authenticity", "estimated_grade",
|
||||
"grade_low", "grade_high", "confidence", "centering", "corners",
|
||||
"edges", "surface", "limitations", "note"],
|
||||
"additionalProperties": False,
|
||||
}
|
||||
|
||||
|
|
@ -720,6 +785,14 @@ def _clean_category(raw):
|
|||
return {"severity": severity, "observation": raw.get("observation") or ""}
|
||||
|
||||
|
||||
def _clean_authenticity(raw):
|
||||
raw = raw if isinstance(raw, dict) else {}
|
||||
flag = raw.get("flag")
|
||||
if flag not in ("none", "worth_checking", "likely_not_genuine"):
|
||||
flag = "none"
|
||||
return {"flag": flag, "observation": raw.get("observation") or ""}
|
||||
|
||||
|
||||
def grade_card(images, api_key=None, model=None, effort=None, zoom_details=True):
|
||||
"""Estimate the PSA grade a card would likely receive, from photo(s).
|
||||
|
||||
|
|
@ -924,6 +997,7 @@ def grade_card(images, api_key=None, model=None, effort=None, zoom_details=True)
|
|||
"closeups": len(crops),
|
||||
"card_type": card_type,
|
||||
"card_note": (parsed.get("card_note") or "").strip(),
|
||||
"authenticity": _clean_authenticity(parsed.get("authenticity")),
|
||||
"edge_measurements": measured,
|
||||
"centering_measurement": centering,
|
||||
"aspect_measurement": aspect,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue