This commit is contained in:
Nicolas Mowen 2025-01-04 13:38:00 -07:00
parent d91aff0712
commit 6909daee14

View File

@ -1,5 +1,6 @@
import { baseUrl } from "@/api/baseUrl"; import { baseUrl } from "@/api/baseUrl";
import AddFaceIcon from "@/components/icons/AddFaceIcon"; import AddFaceIcon from "@/components/icons/AddFaceIcon";
import ActivityIndicator from "@/components/indicators/activity-indicator";
import UploadImageDialog from "@/components/overlay/dialog/UploadImageDialog"; import UploadImageDialog from "@/components/overlay/dialog/UploadImageDialog";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { import {
@ -27,6 +28,8 @@ import { toast } from "sonner";
import useSWR from "swr"; import useSWR from "swr";
export default function FaceLibrary() { export default function FaceLibrary() {
const { data: config } = useSWR<FrigateConfig>("config");
// title // title
useEffect(() => { useEffect(() => {
@ -110,6 +113,10 @@ export default function FaceLibrary() {
[pageToggle, refreshFaces], [pageToggle, refreshFaces],
); );
if (!config) {
return <ActivityIndicator />;
}
return ( return (
<div className="flex size-full flex-col p-2"> <div className="flex size-full flex-col p-2">
<Toaster /> <Toaster />
@ -175,6 +182,7 @@ export default function FaceLibrary() {
{pageToggle && {pageToggle &&
(pageToggle == "train" ? ( (pageToggle == "train" ? (
<TrainingGrid <TrainingGrid
config={config}
attemptImages={trainImages} attemptImages={trainImages}
faceNames={faces} faceNames={faces}
onRefresh={refreshFaces} onRefresh={refreshFaces}
@ -301,7 +309,9 @@ function FaceAttempt({
<div className="capitalize">{data.name}</div> <div className="capitalize">{data.name}</div>
<div <div
className={cn( className={cn(
data.score > threshold ? "text-success" : "text-danger", Number.parseFloat(data.score) > threshold
? "text-success"
: "text-danger",
)} )}
> >
{Number.parseFloat(data.score) * 100}% {Number.parseFloat(data.score) * 100}%