streamlit의 GUI 지원(투명도 조절, 버튼 가운데 정렬)
flux 모델의 로컬PC(Windows 11) 실행
처음엔 gpu, cuda 드라이버 연결이 잘 안되어서 이미지 1장 생성에 30분 걸림
gpu, cuda 드라이버 연결 이후엔 이미지 1장 생성에 1분~1분 30초 걸림
개발 관련 문서 검토
9분할 이미지 확인
target_subject = "a tall glass of iced americano with condensation"
target_grid = "bottom-right third" ##"bottom-left third" # 9분할 위치 (top-left, center, bottom-right 등)
target_bg = "an Ediya Coffee shop interior, blue accents, warm bokeh lighting"
target_text = "EDIYA COFFEE 3.2"
text_position = "bottom-right corner" ##"top-right corner"
# 2. 4가지 조건을 충족하는 정교한 프롬프트 생성
prompt = (
f"A professional advertising photograph. "
f"Subject: {target_subject}. "
f"Composition: The subject is strictly positioned at the {target_grid} of the frame. " # 1. 위치 지정
f"Background: The scene is set in {target_bg}. " # 2. 배경 지정
f"Typography: The text '{target_text}' is rendered in a clean, bold sans-serif font. " # 3. 문구 출력
f"Text Layout: The text is superimposed at the {text_position} of the image. " # 4. 문구 위치 지정
f"Atmosphere: High-resolution, cinematic lighting, realistic textures, 8k."
)
DFD(Data Flow Diagram), API 명세서 검토
DFD를 문구로 작성 위치 잘 먹으면 입력 화면에서 9분할 중 아무곳 터치해서 (예: top-left, 인덱스로 0) fast api 에 0값 전달하고, 리스트에서 0번 찾아서 프롬프트에 "top-left" 적용시키고, 커피 이미지가 좌상단에 나오는지 확인
해당 문구를 기본으로 DFD로 변환(Mermaid 사용)
graph TD
User((사용자)) -- "1. 터치 좌표 (Position)" --> P1[P1: 터치 변환 로직]
User -- "2. 광고 문구 (Text)" --> P2[P2: FastAPI 백엔드]
User -- "3. 배경 설정 (Background)" --> P2
User -- "4. 상세 설정 (Params)" --> P2
P1 -- "5. 그리드 인덱스 (0~8)" --> P2
%% 데이터 조회 계층
subgraph Mapping_Layer [위치 조회 단계]
P2 -- "6. 인덱스 조회 (0~8)" --> D1[(D1: 위치 매핑 리스트)]
D1 -- "7. 상세 위치 문구 반환" --> P2
end
%% 생성 엔진 계층 (D1보다 아래에 배치)
P2 -- "8. 통합 프롬프트 & 설정값 전달" --> P3[P3: Flux AI 엔진]
P3 -- "9. 멀티 레이어 이미지 생성" --> Img(생성된 광고 이미지)
Img -- "10. 최종 결과 반환" --> User

