fix 0 pixel gate, fallback cursur halutination, comment halutination
This commit is contained in:
1 parent
a2543e19d4
commit
364616ec0f
9 files changed
+286
-82
No files matched your search
@@ -141,12 +141,15 @@ def final_checks(task: PlayreelTask) -> list[dict]:
|
||||
playreel에는 그 단계가 없어 검사 자체가 돌지 않는다.
|
||||
"""
|
||||
plan = LongcutPlan.model_validate(task.scene_plan or {"scenes": []})
|
||||
scroll_tags = {scene.tag for scene in plan.scenes if scene.kind == "scroll"}
|
||||
scrolls = [scene for scene in plan.scenes if scene.kind == "scroll"]
|
||||
scroll_tags = {scene.tag for scene in scrolls}
|
||||
return [
|
||||
{"key": "hybrid", "label": "원본 글자 합성",
|
||||
"ok": bool(task.hybrid_clip_url)},
|
||||
# 씬 종류가 scroll이라고 적힌 것만으로는 부족하다 — 실제로 훑은 거리를 본다.
|
||||
# 조각이 화면보다 짧아 한 픽셀도 안 움직인 채 통과한 적이 있다
|
||||
{"key": "scroll", "label": "상세페이지 스크롤",
|
||||
"ok": any(scene.kind == "scroll" for scene in plan.scenes)},
|
||||
"ok": any((scene.y1 or 0.0) > (scene.y0 or 0.0) for scene in scrolls)},
|
||||
{"key": "schedule", "label": "캐스팅 스케줄 포함",
|
||||
"ok": REQUIRED_SECTION_TAG in scroll_tags},
|
||||
{"key": "bgm", "label": "배경음악",
|
||||
|
||||
@@ -55,6 +55,20 @@ async def load_sections(entries: list[dict]) -> list[DetailSection]:
|
||||
for entry in entries]
|
||||
|
||||
|
||||
def section_specs(entries: list[dict]) -> list[DetailSection]:
|
||||
"""compose용 — 조각 그림은 안 받는다. 스크롤은 롱이미지 위에서 일어나고
|
||||
섹션은 어디부터 훑을지를 정하는 좌표로만 쓰인다"""
|
||||
return [DetailSection(source=entry["source"], index=entry["index"],
|
||||
y0=entry["y0"], y1=entry["y1"], tag=entry["tag"])
|
||||
for entry in entries]
|
||||
|
||||
|
||||
async def load_details(task: PlayreelTask) -> dict[str, Image.Image]:
|
||||
"""상세페이지 롱이미지. 이름은 split이 붙인 source와 같아야 한다"""
|
||||
return {f"detail_{order:02d}": Image.open(io.BytesIO(await blob.download_bytes(url)))
|
||||
for order, url in enumerate(task.detail_image_urls or [], 1)}
|
||||
|
||||
|
||||
def working_poster_url(task: PlayreelTask) -> str:
|
||||
"""업스케일이 있으면 그것이 이후 단계의 원본이 됨"""
|
||||
return task.upscaled_poster_url or task.poster_url
|
||||
@@ -234,7 +248,8 @@ async def run_compose(session: AsyncSession, task: PlayreelTask) -> None:
|
||||
meta = NolMeta.model_validate(task.nol_meta)
|
||||
timeline = NarrationTimeline.model_validate(task.narration_timeline)
|
||||
selected = [entry for entry in task.detail_sections or [] if entry["selected"]]
|
||||
sections = await load_sections(selected)
|
||||
sections = section_specs(selected)
|
||||
details = await load_details(task)
|
||||
|
||||
# 하이브리드 합성을 못 거친 클립은 제목이 흔들림
|
||||
clip = await blob.download_bytes(task.hybrid_clip_url or task.clip_url)
|
||||
@@ -245,7 +260,8 @@ async def run_compose(session: AsyncSession, task: PlayreelTask) -> None:
|
||||
|
||||
result = await asyncio.to_thread(
|
||||
compose_longcut, poster, clip, timeline, narration, sections, band_info(meta),
|
||||
bgm_mp3=bgm, qr=Image.open(qr_path) if qr_path.exists() else None, preview=True)
|
||||
details=details, bgm_mp3=bgm,
|
||||
qr=Image.open(qr_path) if qr_path.exists() else None, preview=True)
|
||||
|
||||
filename = f"{task.slug}_30_v{task.version + 1}.mp4"
|
||||
task.video_url = await store_bytes(PIPELINE, task.id, filename, result.video,
|
||||
|
||||
Reference in new issue
Block a user