mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-18 17:14:26 +03:00
Add text color for score
This commit is contained in:
parent
ae68757b66
commit
d91aff0712
@ -18,6 +18,8 @@ import {
|
|||||||
TooltipTrigger,
|
TooltipTrigger,
|
||||||
} from "@/components/ui/tooltip";
|
} from "@/components/ui/tooltip";
|
||||||
import useOptimisticState from "@/hooks/use-optimistic-state";
|
import useOptimisticState from "@/hooks/use-optimistic-state";
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
|
import { FrigateConfig } from "@/types/frigateConfig";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||||
import { LuImagePlus, LuTrash2 } from "react-icons/lu";
|
import { LuImagePlus, LuTrash2 } from "react-icons/lu";
|
||||||
@ -189,11 +191,13 @@ export default function FaceLibrary() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TrainingGridProps = {
|
type TrainingGridProps = {
|
||||||
|
config: FrigateConfig;
|
||||||
attemptImages: string[];
|
attemptImages: string[];
|
||||||
faceNames: string[];
|
faceNames: string[];
|
||||||
onRefresh: () => void;
|
onRefresh: () => void;
|
||||||
};
|
};
|
||||||
function TrainingGrid({
|
function TrainingGrid({
|
||||||
|
config,
|
||||||
attemptImages,
|
attemptImages,
|
||||||
faceNames,
|
faceNames,
|
||||||
onRefresh,
|
onRefresh,
|
||||||
@ -205,6 +209,7 @@ function TrainingGrid({
|
|||||||
key={image}
|
key={image}
|
||||||
image={image}
|
image={image}
|
||||||
faceNames={faceNames}
|
faceNames={faceNames}
|
||||||
|
threshold={config.face_recognition.threshold}
|
||||||
onRefresh={onRefresh}
|
onRefresh={onRefresh}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
@ -215,9 +220,15 @@ function TrainingGrid({
|
|||||||
type FaceAttemptProps = {
|
type FaceAttemptProps = {
|
||||||
image: string;
|
image: string;
|
||||||
faceNames: string[];
|
faceNames: string[];
|
||||||
|
threshold: number;
|
||||||
onRefresh: () => void;
|
onRefresh: () => void;
|
||||||
};
|
};
|
||||||
function FaceAttempt({ image, faceNames, onRefresh }: FaceAttemptProps) {
|
function FaceAttempt({
|
||||||
|
image,
|
||||||
|
faceNames,
|
||||||
|
threshold,
|
||||||
|
onRefresh,
|
||||||
|
}: FaceAttemptProps) {
|
||||||
const data = useMemo(() => {
|
const data = useMemo(() => {
|
||||||
const parts = image.split("-");
|
const parts = image.split("-");
|
||||||
|
|
||||||
@ -288,7 +299,13 @@ function FaceAttempt({ image, faceNames, onRefresh }: FaceAttemptProps) {
|
|||||||
<div className="flex w-full flex-row items-center justify-between gap-2">
|
<div className="flex w-full flex-row items-center justify-between gap-2">
|
||||||
<div className="flex flex-col items-start text-xs text-primary-variant">
|
<div className="flex flex-col items-start text-xs text-primary-variant">
|
||||||
<div className="capitalize">{data.name}</div>
|
<div className="capitalize">{data.name}</div>
|
||||||
<div>{Number.parseFloat(data.score) * 100}%</div>
|
<div
|
||||||
|
className={cn(
|
||||||
|
data.score > threshold ? "text-success" : "text-danger",
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{Number.parseFloat(data.score) * 100}%
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-row items-start justify-end gap-5 md:gap-4">
|
<div className="flex flex-row items-start justify-end gap-5 md:gap-4">
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
|
|||||||
@ -290,6 +290,7 @@ export interface FrigateConfig {
|
|||||||
|
|
||||||
face_recognition: {
|
face_recognition: {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
|
threshold: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
ffmpeg: {
|
ffmpeg: {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user