low resolution 예외처리 앞으로

This commit is contained in:
jaehwang 2026-09-09 11:13:13 +09:00
parent 2140f7d5c8
commit 3ee1c3bdfc
2 changed files with 23 additions and 1 deletions

View File

@ -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}

View File

@ -147,6 +147,18 @@ aspect_ratio·sound는 실질 문제가 아닐 수 있다. Kling은 9:16을 지
이 머신에 higgsfield CLI가 없다. `result_url`·`credits` 정규식 파싱은 원본을 옮겼을 뿐
실제 CLI 출력으로 확인한 것이 아니다.
## 잡 테이블
### is_low_resolution 컬럼이 항상 False다
저해상 거절이 ⑥ i2v에 있어서, 거기까지 가면 detect·나레이션·TTS·BGM을 다 쓰고 터졌다.
같은 기준(`MIN_LONG_EDGE_PX = 1000`)을 업로드 시점으로 옮겨 422로 막는다.
그래서 저해상 포스터는 잡이 아예 안 만들어지고 컬럼은 켜질 일이 없다.
`routers/view.py``low_res`로 내보내지만 프론트는 읽지 않는다.
`i2v.reject_low_resolution`은 서비스를 직접 부르는 경로를 위해 남겨뒀다.
## [Playreel] ③ upscale
### CLI가 파일 경로만 받아 임시 파일이 생긴다