mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-10-26 00:14:41 +03:00
Fix classification model card missing cover image when first category is empty (#24768)
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
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:
@@ -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