Feat: 오토 레이블링 api 연결 - S11P21S002
This commit is contained in:
parent
27c5dbc2b8
commit
d8208b0b79
@ -10,14 +10,6 @@ export async function saveImageLabels(
|
|||||||
return api.post(`/projects/${projectId}/images/${imageId}/label`, data).then(({ data }) => data);
|
return api.post(`/projects/${projectId}/images/${imageId}/label`, data).then(({ data }) => data);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function runAutoLabel(projectId: number, memberId: number) {
|
export async function runAutoLabel(projectId: number, modelId = 1) {
|
||||||
return api
|
return api.post(`/projects/${projectId}/auto`, { modelId }).then(({ data }) => data);
|
||||||
.post(
|
|
||||||
`/projects/${projectId}/label/auto`,
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
params: { memberId },
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.then(({ data }) => data);
|
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,13 @@ import useCanvasStore from '@/stores/useCanvasStore';
|
|||||||
import { Button } from '../ui/button';
|
import { Button } from '../ui/button';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import WorkspaceDropdownMenu from '../WorkspaceDropdownMenu';
|
import WorkspaceDropdownMenu from '../WorkspaceDropdownMenu';
|
||||||
|
import useAutoLabelQuery from '@/queries/projects/useAutoLabelQuery';
|
||||||
|
|
||||||
export default function ProjectStructure({ project }: { project: Project }) {
|
export default function ProjectStructure({ project }: { project: Project }) {
|
||||||
const setProject = useCanvasStore((state) => state.setProject);
|
const setProject = useCanvasStore((state) => state.setProject);
|
||||||
const image = useCanvasStore((state) => state.image);
|
const image = useCanvasStore((state) => state.image);
|
||||||
const { data: folderData, refetch } = useFolderQuery(project.id.toString(), 0);
|
const { data: folderData, refetch } = useFolderQuery(project.id.toString(), 0);
|
||||||
|
const requestAutoLabel = useAutoLabelQuery();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setProject(project);
|
setProject(project);
|
||||||
@ -59,7 +61,9 @@ export default function ProjectStructure({ project }: { project: Project }) {
|
|||||||
<Button
|
<Button
|
||||||
variant="outlinePrimary"
|
variant="outlinePrimary"
|
||||||
className="w-full"
|
className="w-full"
|
||||||
onClick={() => console.log('autolabel')}
|
onClick={() => {
|
||||||
|
requestAutoLabel.mutate({ projectId: project.id }, { onSuccess: refetch });
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Play
|
<Play
|
||||||
size={16}
|
size={16}
|
||||||
|
9
frontend/src/queries/projects/useAutoLabelQuery.ts
Normal file
9
frontend/src/queries/projects/useAutoLabelQuery.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import { runAutoLabel } from '@/api/lablingApi';
|
||||||
|
import { useMutation } from '@tanstack/react-query';
|
||||||
|
|
||||||
|
export default function useAutoLabelQuery() {
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({ projectId, modelId = 1 }: { projectId: number; modelId?: number }) =>
|
||||||
|
runAutoLabel(projectId, modelId),
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user