mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-10-25 07:54:40 +03:00
Fix classification model card missing cover image when first category is empty (#24768)
CI / AMD64 Build (push) Waiting to run
CI / AMD64 Smoke Test (push) Blocked by required conditions
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
CI / AMD64 Build (push) Waiting to run
CI / AMD64 Smoke Test (push) Blocked by required conditions
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
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