Rename: upload_tmp_model -> save_model 로 이름 변경

This commit is contained in:
김진현 2024-09-23 10:45:20 +09:00
parent 05e9a2c03b
commit ae3506d2eb
2 changed files with 6 additions and 5 deletions

View File

@ -1,6 +1,6 @@
from fastapi import APIRouter, HTTPException, File, UploadFile
from schemas.model_create_request import ModelCreateRequest
from services.create_model import create_new_model, upload_tmp_model
from services.create_model import create_new_model, save_model
from services.load_model import load_model
from utils.file_utils import get_model_keys, delete_file, join_path, save_file, get_file_name
import re
@ -63,7 +63,7 @@ def upload_model(project_id:int, file: UploadFile = File(...)):
# YOLO 모델 변환 및 저장
try:
model_path = upload_tmp_model(project_id, tmp_path)
model_path = save_model(project_id, tmp_path)
return {"model_path": model_path}
except Exception as e:
raise HTTPException(status_code=500, detail="file save exception: "+str(e))

View File

@ -29,9 +29,9 @@ def create_new_model(project_id: int, type:str, pretrained:bool):
return f"{unique_id}.pt"
def upload_tmp_model(project_id: int, tmp_path:str):
def save_model(project_id: int, path:str):
# 모델 불러오기
model = load_model(tmp_path)
model = load_model(path)
# 모델을 저장할 폴더 경로
base_path = os.path.join("resources","projects",str(project_id),"models")
@ -47,3 +47,4 @@ def upload_tmp_model(project_id: int, tmp_path:str):
model.save(filename=model_path)
return f"{unique_id}.pt"