mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-18 09:04:28 +03:00
Simplify
This commit is contained in:
parent
be78b59467
commit
fee3209ede
@ -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):
|
def reclassify_face(request: Request, name: str, body: dict = None):
|
||||||
if not request.app.frigate_config.face_recognition.enabled:
|
if not request.app.frigate_config.face_recognition.enabled:
|
||||||
return JSONResponse(
|
return JSONResponse(
|
||||||
|
|||||||
@ -274,32 +274,29 @@ function FaceAttempt({
|
|||||||
[image, onRefresh],
|
[image, onRefresh],
|
||||||
);
|
);
|
||||||
|
|
||||||
const onReprocess = useCallback(
|
const onReprocess = useCallback(() => {
|
||||||
(trainName: string) => {
|
axios
|
||||||
axios
|
.post(`/faces/reprocess`, { training_file: image })
|
||||||
.post(`/faces/train/${trainName}/reprocess`, { training_file: image })
|
.then((resp) => {
|
||||||
.then((resp) => {
|
if (resp.status == 200) {
|
||||||
if (resp.status == 200) {
|
toast.success(`Successfully trained face.`, {
|
||||||
toast.success(`Successfully trained face.`, {
|
position: "top-center",
|
||||||
position: "top-center",
|
});
|
||||||
});
|
onRefresh();
|
||||||
onRefresh();
|
}
|
||||||
}
|
})
|
||||||
})
|
.catch((error) => {
|
||||||
.catch((error) => {
|
if (error.response?.data?.message) {
|
||||||
if (error.response?.data?.message) {
|
toast.error(`Failed to train: ${error.response.data.message}`, {
|
||||||
toast.error(`Failed to train: ${error.response.data.message}`, {
|
position: "top-center",
|
||||||
position: "top-center",
|
});
|
||||||
});
|
} else {
|
||||||
} else {
|
toast.error(`Failed to train: ${error.message}`, {
|
||||||
toast.error(`Failed to train: ${error.message}`, {
|
position: "top-center",
|
||||||
position: "top-center",
|
});
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
});
|
}, [image, onRefresh]);
|
||||||
},
|
|
||||||
[image, onRefresh],
|
|
||||||
);
|
|
||||||
|
|
||||||
const onDelete = useCallback(() => {
|
const onDelete = useCallback(() => {
|
||||||
axios
|
axios
|
||||||
@ -371,7 +368,7 @@ function FaceAttempt({
|
|||||||
<TooltipTrigger>
|
<TooltipTrigger>
|
||||||
<LuRefreshCw
|
<LuRefreshCw
|
||||||
className="size-5 cursor-pointer text-primary-variant hover:text-primary"
|
className="size-5 cursor-pointer text-primary-variant hover:text-primary"
|
||||||
onClick={onReprocess}
|
onClick={() => onReprocess()}
|
||||||
/>
|
/>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent>Delete Face Attempt</TooltipContent>
|
<TooltipContent>Delete Face Attempt</TooltipContent>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user