low resolution 예외처리 앞으로
This commit is contained in:
1 parent
2140f7d5c8
commit
3ee1c3bdfc
2 files changed
+23
-1
No files matched your search
+11
-1
@@ -12,6 +12,7 @@ from pipelines import poster_alive
|
||||
from pipelines.artifact import load_image
|
||||
from pipelines.runner import AWAITING_REVIEW, FAILED, QUEUED, RUNNING, reset_from
|
||||
from routers.view import motion_elements, poster_alive_view
|
||||
from services.i2v import MIN_LONG_EDGE_PX
|
||||
from services.motion import plan_motion
|
||||
from tables.task import PosterAliveTask
|
||||
from utils.database import get_session
|
||||
@@ -66,10 +67,19 @@ async def create(poster: UploadFile = File(...), name: str = Form(""),
|
||||
if len(raw) > MAX_UPLOAD_BYTES:
|
||||
raise HTTPException(413, "30MB 이하만 올릴 수 있습니다")
|
||||
try:
|
||||
Image.open(io.BytesIO(raw)).verify()
|
||||
with Image.open(io.BytesIO(raw)) as image:
|
||||
width, height = image.size
|
||||
image.verify()
|
||||
except Exception:
|
||||
raise HTTPException(422, "이미지 파일을 열 수 없습니다")
|
||||
|
||||
# i2v가 확대 시 뭉개져 거절한다. 거기까지 가면 나레이션·TTS·BGM을 다 쓰고 터지므로
|
||||
# 같은 기준을 업로드에서 먼저 건다
|
||||
if max(width, height) < MIN_LONG_EDGE_PX:
|
||||
raise HTTPException(
|
||||
422, f"포스터 긴 변이 {MIN_LONG_EDGE_PX}px 이상이어야 합니다 "
|
||||
f"(받은 것: {width}x{height}). 고해상 원본으로 올려주세요.")
|
||||
|
||||
# 이름을 비워 두면 narration_text 가 포스터에서 읽은 행사명으로 채운다
|
||||
task = await poster_alive.create_task(session, name.strip(), raw, skip_review=auto)
|
||||
return {"id": task.id, "ahead": 0}
|
||||
|
||||
Reference in new issue
Block a user