diff --git a/web/src/components/card/SearchThumbnail.tsx b/web/src/components/card/SearchThumbnail.tsx index a2c5cd37f0..5720f9934f 100644 --- a/web/src/components/card/SearchThumbnail.tsx +++ b/web/src/components/card/SearchThumbnail.tsx @@ -69,6 +69,30 @@ export default function SearchThumbnail({ return `${searchResult.label}-verified`; }, [config, hasRecognizedPlate, searchResult]); + const objectDetail = useMemo(() => { + if (!config) { + return undefined; + } + + if (!searchResult.sub_label) { + if (hasRecognizedPlate) { + return `(${searchResult.data.recognized_license_plate} ${Math.round((searchResult.data.recognized_license_plate_score ?? 1) * 100)}%)`; + } + + return undefined; + } + + if ( + config.model.attributes_map[searchResult.label]?.includes( + searchResult.sub_label, + ) + ) { + return ""; + } + + return `(${searchResult.sub_label} ${Math.round((searchResult.data.sub_label_score ?? 1) * 100)}%)`; + }, [config, hasRecognizedPlate, searchResult]); + return (