dk - edit
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
from person_attr import PersonAttribute
|
||||
|
||||
# 실제 사용하시는 모델 아키텍처 라이브러리 임포트 필요
|
||||
# from person_attr import PersonAttributeModel
|
||||
|
||||
|
||||
class PersonAttrService(PersonAttribute):
|
||||
def __init__(self):
|
||||
# ClearML이 load(model_filepath)로 가중치를 주입하므로 초기 로드는 생략
|
||||
super().__init__(auto_load=False)
|
||||
|
||||
def load(self, model_filepath):
|
||||
"""ClearML이 다운로드한 가중치 경로(model_filepath)를 받아 모델을 로드합니다."""
|
||||
|
||||
# 1. (선택) 추가 설정/아키텍처 초기화가 필요하면 여기에 작성
|
||||
# 2. 모델 아키텍처 초기화는 PersonAttribute.load_model()에서 수행
|
||||
# 3. 가중치 로드
|
||||
super().load(model_filepath)
|
||||
|
||||
print(f"[{self.device}] Model loaded successfully using: {model_filepath}")
|
||||
|
||||
def predict(self, request: dict):
|
||||
"""엔드포인트로 들어온 데이터 추론 (예: 오디오 데이터)"""
|
||||
# 이 부분은 클라이언트가 보내는 데이터 형식에 따라 파싱 로직을 수정해야 합니다.
|
||||
image_url = request.get("image_url") or request.get("url")
|
||||
xywh = request.get("xywh")
|
||||
|
||||
# 텐서 변환 및 추론
|
||||
attributes = self.process(str(image_url), str(xywh))
|
||||
|
||||
# 결과 반환 (반드시 JSON 직렬화가 가능한 dict, list 등 형태여야 함)
|
||||
return attributes
|
||||
Reference in New Issue
Block a user