This commit is contained in:
Nicolas Mowen 2025-01-29 07:30:49 -07:00
parent be78b59467
commit fee3209ede
2 changed files with 25 additions and 28 deletions

View File

@ -100,7 +100,7 @@ def train_face(request: Request, name: str, body: dict = None):
)
@router.post("/faces/train/{name}/reprocess")
@router.post("/faces/reprocess")
def reclassify_face(request: Request, name: str, body: dict = None):
if not request.app.frigate_config.face_recognition.enabled:
return JSONResponse(

View File

@ -274,32 +274,29 @@ function FaceAttempt({
[image, onRefresh],
);
const onReprocess = useCallback(
(trainName: string) => {
axios
.post(`/faces/train/${trainName}/reprocess`, { training_file: image })
.then((resp) => {
if (resp.status == 200) {
toast.success(`Successfully trained face.`, {
position: "top-center",
});
onRefresh();
}
})
.catch((error) => {
if (error.response?.data?.message) {
toast.error(`Failed to train: ${error.response.data.message}`, {
position: "top-center",
});
} else {
toast.error(`Failed to train: ${error.message}`, {
position: "top-center",
});
}
});
},
[image, onRefresh],
);
const onReprocess = useCallback(() => {
axios
.post(`/faces/reprocess`, { training_file: image })
.then((resp) => {
if (resp.status == 200) {
toast.success(`Successfully trained face.`, {
position: "top-center",
});
onRefresh();
}
})
.catch((error) => {
if (error.response?.data?.message) {
toast.error(`Failed to train: ${error.response.data.message}`, {
position: "top-center",
});
} else {
toast.error(`Failed to train: ${error.message}`, {
position: "top-center",
});
}
});
}, [image, onRefresh]);
const onDelete = useCallback(() => {
axios
@ -371,7 +368,7 @@ function FaceAttempt({
<TooltipTrigger>
<LuRefreshCw
className="size-5 cursor-pointer text-primary-variant hover:text-primary"
onClick={onReprocess}
onClick={() => onReprocess()}
/>
</TooltipTrigger>
<TooltipContent>Delete Face Attempt</TooltipContent>