45 lines
1.6 KiB
Python
45 lines
1.6 KiB
Python
"""motion 수동 확인용.
|
|
|
|
사용: uv run python test_motion.py <포스터경로> [모션키,쉼표구분]
|
|
모션키를 주면 VLM을 건너뛰고 그 목록으로 프롬프트를 만든다(빈 문자열이면 0종).
|
|
결과는 test_result/<이름>.motion.txt(채택·탈락)와 <이름>.i2v.txt(프롬프트 원문)로 떨어진다.
|
|
"""
|
|
import asyncio
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
from services.motion import plan_motion
|
|
|
|
TEST_RESULT_DIR = Path(__file__).parent / "test_result"
|
|
|
|
|
|
async def main() -> None:
|
|
poster_path = Path(sys.argv[1])
|
|
force_motions = None
|
|
if len(sys.argv) > 2:
|
|
force_motions = [key.strip() for key in sys.argv[2].split(",") if key.strip()]
|
|
|
|
TEST_RESULT_DIR.mkdir(exist_ok=True)
|
|
output_base = TEST_RESULT_DIR / poster_path.stem
|
|
|
|
plan = await plan_motion(poster_path, force_motions=force_motions)
|
|
|
|
summary_path = output_base.with_suffix(".motion.txt")
|
|
prompt_path = output_base.with_suffix(".i2v.txt")
|
|
summary_path.write_text(
|
|
plan.model_dump_json(indent=2, exclude={"prompt"}), encoding="utf-8")
|
|
prompt_path.write_text(plan.prompt, encoding="utf-8")
|
|
|
|
print(f"QR {'있음' if plan.has_qr else '없음'} / 채택 {len(plan.kept)}종")
|
|
for item in plan.kept:
|
|
print(f" ✓ {item.motion:9} {item.what}")
|
|
for item in plan.dropped:
|
|
print(f" ✗ {item.motion:9} {item.what} — {item.why}")
|
|
if not plan.kept:
|
|
print("\n※ 움직일 요소가 없다 — i2v를 건너뛰고 정지 포스터로 가는 것이 안전하다.")
|
|
print(f"\n{summary_path}\n{prompt_path}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|