mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-11-19 15:23:20 +00:00
Fix classification model card missing cover image when first category is empty (#24768)
The cover image only checked the first category returned by the dataset API (after skipping none/unknown) and gave up if it had no images. Since category order follows the dataset directory listing, a model whose first listed category is still empty showed the skeleton placeholder even when other categories had plenty of images. Use the first category that actually has images instead.
This commit is contained in:
1 parent
f7d532a09d
commit
04c62c2ce3
1 file changed
+5
-6
@@ -271,17 +271,16 @@ function ModelCard({ config, onClick, onUpdate, onDelete }: ModelCardProps) {
|
||||
(key) => key != "none" && key.toLowerCase() != "unknown",
|
||||
);
|
||||
|
||||
if (keys.length === 0) {
|
||||
const selectedKey = keys.find(
|
||||
(key) => (dataset.categories[key]?.length ?? 0) > 0,
|
||||
);
|
||||
|
||||
if (!selectedKey) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const selectedKey = keys[0];
|
||||
const images = dataset.categories[selectedKey];
|
||||
|
||||
if (!images || images.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return {
|
||||
name: selectedKey,
|
||||
img: images[0],
|
||||
|
||||
Reference in new issue
Block a user