
    Ij&                     @   d Z ddlZddlZddlZddlZddlmZ ej                  j                  d e
 ee      j                               ddlZej                  dz  ZdZdddiddiddiddiddiddiddiddidd	d
d	g dddZd Zd Zd Zd Zedk(  r e        yy)u  s9 — 5라운드(사용자 지시): LLM 프롬프트 저작 버드아이즈뷰 4종 교차 실험.

옥탑방 관련 모든 내용(그룹 멤버+전 샷 원문)을 취합해 **LLM 이 4개의 이미지
프롬프트를 직접 작성**(fp/도면 참조 없음 — 프롬프트 저작력 자체를 검증):
  1. 위에서 본 스케치 (완전 수직 아님 — 약 150도, 수직에서 ~30도 기울임) 순수 T2I
  2. 버드아이즈 뷰 — 1번 이미지를 참조(I2I)
  3. 버드아이즈 뷰 — 참조 없이 순수 T2I
  4. 스케치(1번과 같은 형태) — 3번 이미지를 참조(I2I)
산출: out/birdseye/{p1..p4}.png + plans/birdseye_prompts.json + birdseye.html
사용: .venv/bin/python s9_birdseye_prompts.py [--only prompts|images|html]
    N)Path	birdseye2u	  You write text-to-image prompts for LOCATION REFERENCE ASSETS in film
pre-production. The place is a scouted location: an upper rooftop dwelling on an old
multi-family building, with its terrace, an exterior stair, the building body, the
ground-level entrance/alley approach, and immediate surroundings. You get production
data (member descriptions + full shot contents) — extract ONLY the permanent physical
anatomy of the place from it.

Write FOUR ENGLISH image prompts. HARD STYLE RULES for every prompt:
- CONCISE. 60-110 words each. List what must be IN the image — nothing else.
- This is a NEUTRAL location document. NO storytelling, NO mood, NO atmosphere
  words, NO weather, NO time-of-day drama, NO lighting effects (no glow, no haze,
  no wet reflections), NO story props or states (no flyers, no vehicles, no lit
  windows). Plain even daylight. Cinematic dressing happens later in shots — never
  here.
- Include only PERMANENT physical elements grounded in the data (structures,
  levels, stair, openings, fixed rooftop fixtures).
- Never expose interior rooms/furniture. No people, no animals, no text/letters/
  numbers/logos in the image.
- View: from high above at an oblique angle, tilted about 30 degrees from vertical
  (NOT straight down), so wall heights, the stair run and level differences read.
- Whole property in one view: rooftop dwelling shell + terrace + fixtures, the
  building body below, exterior stair from ground rear corner to rooftop, ground
  entrance yard/alley, small margin of neighbours.

The four prompts:
1. prompt_1_plan: a technical PLAN DRAWING in the exact drafting style of a clean
   architectural floor plan (thin dark outlines, flat colour fills, simple fixture
   symbols) but drawn with slight axonometric depth at that oblique angle. Pure
   text-to-image.
2. prompt_2_birdseye_from_plan: photorealistic bird's-eye of the same place;
   image-edit prompt — keep the attached drawing's layout, proportions and camera
   angle exactly; render real materials in plain daylight.
3. prompt_3_birdseye_pure: photorealistic bird's-eye, standalone text-to-image;
   the text alone carries the layout.
4. prompt_4_plan_from_birdseye: same technical plan-drawing form as prompt 1;
   image-edit prompt — redraw the attached photo in that drafting style, keeping
   layout and camera angle exactly.

Also output a faithful KOREAN translation of each prompt (for human review only;
the image model receives the English).objecttypestringz%what data grounded the layout choices)r   description)	prompt_1_planprompt_1_plan_koprompt_2_birdseye_from_planprompt_2_birdseye_from_plan_koprompt_3_birdseye_pureprompt_3_birdseye_pure_koprompt_4_plan_from_birdseyeprompt_4_plan_from_birdseye_konotesF)r   
propertiesrequiredadditionalPropertiesc           
         t        j                  | d         }dj                  d t        | d   j	                               D              }d|z   dz   |z   dz   }t        j
                  dt        |t        d	
      }t        j                  d|       dD ].  }t        d| dt        ||   j                                d       0 |S )Nmembersz

c              3   N   K   | ]  \  }}t        j                  ||        y wN)F
shot_block).0kss      s9_birdseye_prompts.py	<genexpr>zgen_prompts.<locals>.<genexpr>Y   s%      G'Etq!Q'Es   #%shotszPLACE MEMBERS:
z+

ALL SHOTS AT THIS PLACE (full content):

z

Write the four prompts now.forest_birdseye_prompts_v2gpt)modelbirdseye_prompts_v2)r	   r   r   r   z--- z (z words))r   members_blockjoinsorteditemsllm
GEN_SYSTEM
GEN_SCHEMA	save_planprintlensplit)reconr   shot_blocksuseroutr   s         r   gen_promptsr4   W   s    ooeI./G++ G'-eGn.B.B.D'EG GK(?@BMN/0D %%,j$
CKK%s+GQCr#c!flln-.g67G J    c                 N   t         j                  dd       t        j                  d| d   d t         dz        }t        j                  d| d   |gt         d	z         t        j                  d
| d   d t         dz        }t        j                  d| d   |gt         dz         y )NT)parentsexist_okbird2_p1_planr	   p1_plan_t2i.png)refsout_pathbird2_p2_from_planr   p2_birdseye_from_p1.pngbird2_p3_purer   p3_birdseye_t2i.pngbird2_p4_from_birdseyer   p4_plan_from_p3.png)OUTBmkdirr   img_gpt)pp1p3s      r   imagesrI   g   s    JJtdJ+	
?Ao$6T #44
6BII"A&C$D4$)B"BD	
?A&>$?d #88
:BII&*G(H4$)>">@r5   c                    d$d}t        d dD              }|rdnd}d| d |dd	d
| d   | d          d |ddd| d   | d   d       d |ddd| d   | d          d |ddd| d   | d   d       dt        j                  | j                  d d             d!}t        j
                  d"z  j                  |       t        d#t        j
                  d"z          y )%N c                 r   t         | z  }dt        j                  |       dt        j                  |       d}|j                         sd| dt        j                  |       d| dS |j	                  t
        j                        }|rd| dnd	}	d| dt        j                  |       d
|	 d| d| d| dS )Nu>   <details open><summary>프롬프트 (한국어)</summary><pre>uR   </pre></details><details><summary>영어 원문 (실제 T2I 입력)</summary><pre>z</pre></details>z<div class='cell'><h3>z. uJ   </h3><div class='ref'>⏳ 생성 중… (완료되면 자동 표시)</div>z</div>u#   <div class='ref'>참조 이미지: u1   <div class='ref'>참조 없음 (순수 T2I)</div>z</h3>z	<a href='z' target='_blank'><img src='z'></a>)rC   _htmlescapeexistsrelative_tor   EXP)
fnnotitle	prompt_ko	prompt_enreffdetrelreflines
             r   cellzbuild_html.<locals>.cellt   s    2I||I./ 0||I.//?A xxz,RD5<<3F2G H\\_[``fh immAEE"GJ7uFC? 	(Bu||E/B.C5	C5 <SEuFT 	Ur5   c              3   L   K   | ]  }t         |z  j                            y wr   )rC   rO   )r   rR   s     r   r   zbuild_html.<locals>.<genexpr>   s)      7 66rtby((** 66s   "$)r:   r>   r@   rB   z(<meta http-equiv='refresh' content='30'>z<meta charset='utf-8'>u  <title>birdseye 4-prompt 교차 실험</title><style>
body{font-family:sans-serif;background:#171717;color:#eee;margin:24px;max-width:1760px}
.grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}
.cell{background:#222;padding:12px;border-radius:10px}
.cell img{width:100%;border-radius:6px}
h1{font-size:22px} h3{color:#fd9;margin:2px 0 6px}
.ref{color:#8ac;font-size:13px;margin-bottom:6px}
pre{white-space:pre-wrap;font-size:11px;color:#9c9;max-height:320px;overflow:auto;background:#1b1b1b;padding:8px}
.guide{background:#1e2430;padding:12px 16px;border-radius:8px;font-size:13px;line-height:1.6;margin-bottom:14px}
</style>
<h1>버드아이즈뷰 4-프롬프트 교차 실험 v2 — 간결·중립(로케이션 문서) 계약</h1>
<div class='guide'>수정 반영: <b>스케치=fp 도면 언어+약간의 입체감(수직에서 ~30° 기울임)</b>,
프롬프트=<b>간결(60-110단어)·담을 내용만</b> — 영화적 무드/조명/이야기 소품 금지(중립 주광,
섭외 로케이션 문서). 영화적 표현은 실제 샷 생성 때만. 경로 비교:
<b>①도면(T2I) → ②버드아이(①참조)</b> vs <b>③버드아이(순수 T2I) → ④도면(③참조)</b>.</div>
<div class='grid'>
r:      u#   fp형 도면+입체감 (순수 T2I)r
   r	   
r>      u.   버드아이즈 뷰 (①번 도면 참조 I2I)r   r   u   ① p1_plan_t2i.pngr@      u7   버드아이즈 뷰 (참조 없이 순수 프롬프트)r   r   rB      u6   fp형 도면 (①과 같은 형태, ③번 참조 I2I)r   r   u   ③ p3_birdseye_t2i.pngum   
</div>
<details style='margin-top:16px'><summary>프롬프트 저작 LLM 의 grounding notes</summary>
<pre>r   z</pre></details>
zbirdseye.htmlzpage -> )rK   )anyrM   rN   getr   rQ   
write_textr-   )rF   r\   pendingrefreshdocs        r   
build_htmlri   s   sw   U  7 66 7 7G =D8G$WI .  A1EWCXZ[\kZlm n o$TVWXxVy{|  ~[  |\  ^s  t  u uQ Y[\]x[y{|  ~V  |W  X  Y YQ XZ[\|Z}  @A  B_  @`  b{  |  } } ll155"%&' (-C0 UU_((-	HQUU_,-
./r5   c                     t        j                         } | j                  ddg d       | j                         }t	        j
                         }|j                  dv rt        |      }nt	        j                  d      }|j                  dv rt        |       |j                  dv rt        |       t	        j                  d	d
|j                  d       y )Nz--onlyall)rk   promptsrI   html)defaultchoices)rk   rl   r$   )rk   rI   )rk   rm   stages9_birdseye)kindrp   done)argparseArgumentParseradd_argument
parse_argsr   
load_recononlyr4   	load_planrI   ri   runlog)apargsr0   rF   s       r   mainr~      s    		 	 	"BOOHe 6>O ?==?DLLNEyy&&KK-.yy%%q	yyO#1HHgtyyIJr5   __main__)__doc__rt   rm   rM   jsonsyspathlibr   pathinsertstr__file__parent
forest_libr   OUTrC   r*   r+   r4   rI   ri   r~   __name__ r5   r   <module>r      s   
    
  3tH~,,- . uu{'*
T  (+#X.(.'9+18*<#)8"4&,h%7(.'9+18*<"!HJ
 "'
. 	@-0`K" zF r5   