gate2까지 플로우 정리

This commit is contained in:
jaehwang committed 2026-09-07 15:25:03 +09:00
1 parent 53f308eac2
commit 5e4ff5f962
15 files changed
+755 -4

No files matched your search

+5 -3
View File
@@ -8,7 +8,7 @@ import httpx
from PIL import Image
from models.detect import Regions
from models.i2v import I2vResult
from models.i2v import I2vResult, TitleGateVerdict
from services.title_gate import check_title
from settings import settings
from utils.higgsfield import (KLING_3_0, assert_account, parse_credits, parse_result_url,
@@ -45,7 +45,7 @@ async def estimate_credits(prompt: str, poster: Path, model: str = KLING_3_0) ->
"generate", "cost", model, *cli_args(prompt, poster, model), "--json", timeout=300))
async def animate(prompt: str, poster: Path, regions: Regions, *,
async def animate(prompt: str, poster: Path, regions: Regions | None = None, *,
model: str = KLING_3_0,
max_credits: float = MAX_CREDITS) -> I2vResult:
if not prompt.strip():
@@ -66,7 +66,9 @@ async def animate(prompt: str, poster: Path, regions: Regions, *,
if len(clip) < MIN_CLIP_BYTES:
raise RuntimeError(f"클립이 너무 작다 ({len(clip)}바이트) — 다운로드 실패로 본다")
verdict = await check_title(clip, regions)
# 영역 좌표가 없으면 제목 훼손을 잴 근거가 없다. 통과시키되 그 사실을 남긴다
verdict = (await check_title(clip, regions) if regions
else TitleGateVerdict(passed=True, skip="regions 없음 — 제목 게이트 미실행"))
if not verdict.passed:
raise RuntimeError(f"제목 훼손 감지 — {verdict.reason} "
"(재렌더하거나 모션 요소를 줄여보세요)")