From f628a84477cb8d1937e7bd87ecf0b615db1ec3b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=ED=98=84=EC=A1=B0?= Date: Wed, 2 Oct 2024 23:14:16 +0900 Subject: [PATCH] =?UTF-8?q?Refactor:=20=ED=95=99=EC=8A=B5=20=EA=B7=B8?= =?UTF-8?q?=EB=9E=98=ED=94=84=20=EB=8C=80=EA=B8=B0=20=ED=91=9C=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/ModelManage/EvaluationTab.tsx | 1 + .../components/ModelManage/ModelLineChart.tsx | 39 ++++++++++++++++++- .../components/ModelManage/TrainingGraph.tsx | 1 + 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/ModelManage/EvaluationTab.tsx b/frontend/src/components/ModelManage/EvaluationTab.tsx index b6c112b..18d4d1a 100644 --- a/frontend/src/components/ModelManage/EvaluationTab.tsx +++ b/frontend/src/components/ModelManage/EvaluationTab.tsx @@ -123,6 +123,7 @@ function ModelEvaluation({ projectId, selectedModel }: ModelEvaluationProps) { {/* 차트의 높이를 100%로 맞춤 */} diff --git a/frontend/src/components/ModelManage/ModelLineChart.tsx b/frontend/src/components/ModelManage/ModelLineChart.tsx index 5b6519b..5e97766 100644 --- a/frontend/src/components/ModelManage/ModelLineChart.tsx +++ b/frontend/src/components/ModelManage/ModelLineChart.tsx @@ -4,9 +4,11 @@ import { CartesianGrid, Line, LineChart, XAxis, YAxis, Tooltip, Legend } from 'r import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { ChartConfig, ChartContainer } from '@/components/ui/chart'; import { ReportResponse } from '@/types'; +import { Spinner } from '@/components/ui/spinner'; interface ModelLineChartProps { data: ReportResponse[]; + isTraining: boolean; className?: string; } @@ -33,7 +35,7 @@ const chartConfig = { }, } satisfies ChartConfig; -export default function ModelLineChart({ data, className }: ModelLineChartProps) { +export default function ModelLineChart({ data, isTraining, className }: ModelLineChartProps) { const latestData = data.length > 0 ? data[data.length - 1] : undefined; const totalEpochs = latestData?.totalEpochs || 0; @@ -55,6 +57,7 @@ export default function ModelLineChart({ data, className }: ModelLineChartProps) const hasNonZeroData = filledData.some((d) => d[dataKey] !== 0); return hasNonZeroData ? ( ) : null; }; + return ( @@ -73,7 +77,7 @@ export default function ModelLineChart({ data, className }: ModelLineChartProps)

현재 에포크: {latestData.epoch}

총 에포크: {latestData.totalEpochs}

-

예상 남은시간: {latestData.leftSecond}초

+

예상 남은시간: {latestData.leftSecond.toFixed(2)}초

)} @@ -101,6 +105,37 @@ export default function ModelLineChart({ data, className }: ModelLineChartProps) {renderLine('dflLoss', chartConfig.dflLoss.color)} {renderLine('fitness', chartConfig.fitness.color)} {renderLine('segLoss', chartConfig.segLoss.color)} + + {isTraining && data.length === 0 && ( + +
+
+ +

대기 중...

+
+
+
+ )} + {!isTraining && data.length === 0 && ( + +
+ 학습 중이 아닙니다. +
+
+ )}
diff --git a/frontend/src/components/ModelManage/TrainingGraph.tsx b/frontend/src/components/ModelManage/TrainingGraph.tsx index 487b030..9e282a5 100644 --- a/frontend/src/components/ModelManage/TrainingGraph.tsx +++ b/frontend/src/components/ModelManage/TrainingGraph.tsx @@ -27,6 +27,7 @@ export default function TrainingGraph({ return ( );