Skip to content

Commit

Permalink
tensorflow 예외문 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
j-ra1n committed Jan 24, 2025
1 parent a9fd1a6 commit f72500c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public enum ExceptionMessage {
CONTENT_NOT_ALLOWED("컨텐츠에 유해성이 감지되어 저장에 실패했습니다."),
CONTENT_ANALYSIS_FAILED("컨텐츠 분석에 실패했습니다."),

// Tensorflow
GRAPH_LOAD_FAILED("GraphDef 파일을 로드하는 데 실패했습니다"),

// Image
IMAGE_METADATA_FAILED("이미지 메타데이터 추출에 실패했습니다.");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.urdego.urdego_content_service.domain.service.model.nsfw;

import io.urdego.urdego_content_service.common.exception.ExceptionMessage;
import io.urdego.urdego_content_service.common.exception.content.UserContentException;
import org.tensorflow.Graph;
import org.tensorflow.Session;
import org.tensorflow.Tensor;
Expand Down Expand Up @@ -30,9 +32,7 @@ public class NSFWDetector {
byte[] graphDef = Files.readAllBytes(MODEL_PATH);
graph.importGraphDef(GraphDef.parseFrom(graphDef));
} catch (IOException e) {
System.err.println("GraphDef 파일을 로드하는 데 실패했습니다: " + e.getMessage());
e.printStackTrace();
throw new RuntimeException("Failed to load GraphDef", e);
throw new UserContentException(ExceptionMessage.GRAPH_LOAD_FAILED);
}
}

Expand Down

0 comments on commit f72500c

Please sign in to comment.