From b296375d84f56d309f4758776be70fc35d493599 Mon Sep 17 00:00:00 2001 From: seungtaekhong Date: Fri, 12 Jan 2024 13:55:34 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=9E=84=EC=8B=9C=20=EB=9D=BC=EB=B2=A8?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/inference/api/ClientInferenceController.java | 3 +++ .../gdsc/PathPal/domain/inference/domain/Label.java | 3 +++ .../domain/inference/service/InferenceService.java | 9 ++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/solution/gdsc/PathPal/domain/inference/api/ClientInferenceController.java b/src/main/java/solution/gdsc/PathPal/domain/inference/api/ClientInferenceController.java index 579562d..b6ce483 100644 --- a/src/main/java/solution/gdsc/PathPal/domain/inference/api/ClientInferenceController.java +++ b/src/main/java/solution/gdsc/PathPal/domain/inference/api/ClientInferenceController.java @@ -45,8 +45,11 @@ protected void handleBinaryMessage(WebSocketSession session, BinaryMessage messa String responseMessage = ""; try { List inferences = socketClient.inferenceImage(bytes); + System.out.println("Inference 변환 성공"); List inferenceTranslates = inferenceService.convertInference(inferences); + System.out.println("Translate 성공"); responseMessage = JsonUtil.toJsonFormat(inferenceTranslates); + System.out.println("json 변환 성공"); } catch (Exception e) { System.err.println("추론 실패"); responseMessage = "[]"; diff --git a/src/main/java/solution/gdsc/PathPal/domain/inference/domain/Label.java b/src/main/java/solution/gdsc/PathPal/domain/inference/domain/Label.java index f15321d..75d7286 100644 --- a/src/main/java/solution/gdsc/PathPal/domain/inference/domain/Label.java +++ b/src/main/java/solution/gdsc/PathPal/domain/inference/domain/Label.java @@ -55,6 +55,9 @@ public enum Label { beverage_vending_machine("음료 자판기", "Beverage vending machine"), trash_can("쓰레기통", "Trash can"), + + temporary_label("[임시 라벨입니다]", "[temporary label]"), // TODO + ; private final String korean; private final String english; diff --git a/src/main/java/solution/gdsc/PathPal/domain/inference/service/InferenceService.java b/src/main/java/solution/gdsc/PathPal/domain/inference/service/InferenceService.java index 49f5374..db18c19 100644 --- a/src/main/java/solution/gdsc/PathPal/domain/inference/service/InferenceService.java +++ b/src/main/java/solution/gdsc/PathPal/domain/inference/service/InferenceService.java @@ -21,7 +21,14 @@ public List convertInference(List inferences) { continue; } - Label label = getLabel(inference); + // TODO + Label label = null; + try { + label = getLabel(inference); + } catch (Exception e) { + label = Label.temporary_label; + } + Direction direction = getDirection(inference); InferenceTranslate inferenceTranslate = new InferenceTranslate(inference.alert(), label, direction);