Update app.py
Browse files
app.py
CHANGED
@@ -229,31 +229,31 @@ def process_and_show_prompt(image1, image2, image3, prompt, product_name, produc
|
|
229 |
try:
|
230 |
# 배경 옵션을 딕셔너리로 구성
|
231 |
bg_options = {
|
232 |
-
"product_name": product_name,
|
233 |
"product_category": product_category,
|
234 |
"background_type": background_type,
|
235 |
"background_style": background_style,
|
236 |
"lighting": lighting,
|
237 |
-
"texture": texture,
|
238 |
-
"color_tone": color_tone,
|
239 |
-
"mood": mood
|
240 |
}
|
241 |
|
242 |
result_img, status, final_prompt = process_images_with_prompt(image1, image2, image3, prompt, bg_options)
|
243 |
|
244 |
# 선택된 옵션을 문자열로 구성
|
245 |
-
options_summary = f"상품명: {product_name}\n"
|
246 |
options_summary += f"제품군: {product_category}\n"
|
247 |
options_summary += f"배경 유형: {background_type}\n"
|
248 |
options_summary += f"세부 스타일: {background_style}\n"
|
249 |
|
250 |
if lighting:
|
251 |
options_summary += f"조명: {lighting}\n"
|
252 |
-
if texture:
|
253 |
options_summary += f"배경 질감: {texture}\n"
|
254 |
-
if color_tone:
|
255 |
options_summary += f"색감: {color_tone}\n"
|
256 |
-
if mood:
|
257 |
options_summary += f"분위기: {mood}\n"
|
258 |
|
259 |
# 한국어와 영어 프롬프트 비교를 위해 원본 프롬프트 확인
|
@@ -297,11 +297,11 @@ def update_preview(product_name, product_category, background_type, background_s
|
|
297 |
|
298 |
if lighting:
|
299 |
preview += f"조명: {lighting}\n"
|
300 |
-
if texture:
|
301 |
preview += f"배경 질감: {texture}\n"
|
302 |
-
if color_tone:
|
303 |
preview += f"색감: {color_tone}\n"
|
304 |
-
if mood:
|
305 |
preview += f"분위기: {mood}\n"
|
306 |
|
307 |
return preview
|
@@ -388,25 +388,25 @@ with gr.Blocks() as demo:
|
|
388 |
|
389 |
# 배경 질감 드롭다운
|
390 |
texture = gr.Dropdown(
|
391 |
-
choices=["흰 벽", "대리석", "나무", "벽돌", "흰 천", "시멘트"],
|
392 |
label="배경 질감 선택",
|
393 |
-
value="",
|
394 |
visible=False
|
395 |
)
|
396 |
|
397 |
# 색감 드롭다운
|
398 |
color_tone = gr.Dropdown(
|
399 |
-
choices=["화이트 톤", "블루 톤", "따뜻한 색상", "모노톤", "파스텔"],
|
400 |
label="색감 선택",
|
401 |
-
value="",
|
402 |
visible=False
|
403 |
)
|
404 |
|
405 |
# 분위기 드롭다운
|
406 |
mood = gr.Dropdown(
|
407 |
-
choices=["포근한", "심플한", "모던한", "내추럴", "미니멀"],
|
408 |
label="분위기 선택",
|
409 |
-
value="",
|
410 |
visible=False
|
411 |
)
|
412 |
|
@@ -414,7 +414,7 @@ with gr.Blocks() as demo:
|
|
414 |
selection_preview = gr.Textbox(
|
415 |
label="선택 내용 미리보기",
|
416 |
lines=8,
|
417 |
-
|
418 |
visible=False
|
419 |
)
|
420 |
|
@@ -566,7 +566,6 @@ with gr.Blocks() as demo:
|
|
566 |
outputs=[output_image, output_text, prompt_display, options_summary, kr_prompt_display],
|
567 |
)
|
568 |
|
569 |
-
|
570 |
gr.Markdown(
|
571 |
"""
|
572 |
### 사용 방법:
|
|
|
229 |
try:
|
230 |
# 배경 옵션을 딕셔너리로 구성
|
231 |
bg_options = {
|
232 |
+
"product_name": product_name if product_name else "상품",
|
233 |
"product_category": product_category,
|
234 |
"background_type": background_type,
|
235 |
"background_style": background_style,
|
236 |
"lighting": lighting,
|
237 |
+
"texture": texture if texture != "선택 안함" else "",
|
238 |
+
"color_tone": color_tone if color_tone != "선택 안함" else "",
|
239 |
+
"mood": mood if mood != "선택 안함" else ""
|
240 |
}
|
241 |
|
242 |
result_img, status, final_prompt = process_images_with_prompt(image1, image2, image3, prompt, bg_options)
|
243 |
|
244 |
# 선택된 옵션을 문자열로 구성
|
245 |
+
options_summary = f"상품명: {product_name if product_name else '지정되지 않음'}\n"
|
246 |
options_summary += f"제품군: {product_category}\n"
|
247 |
options_summary += f"배경 유형: {background_type}\n"
|
248 |
options_summary += f"세부 스타일: {background_style}\n"
|
249 |
|
250 |
if lighting:
|
251 |
options_summary += f"조명: {lighting}\n"
|
252 |
+
if texture and texture != "선택 안함":
|
253 |
options_summary += f"배경 질감: {texture}\n"
|
254 |
+
if color_tone and color_tone != "선택 안함":
|
255 |
options_summary += f"색감: {color_tone}\n"
|
256 |
+
if mood and mood != "선택 안함":
|
257 |
options_summary += f"분위기: {mood}\n"
|
258 |
|
259 |
# 한국어와 영어 프롬프트 비교를 위해 원본 프롬프트 확인
|
|
|
297 |
|
298 |
if lighting:
|
299 |
preview += f"조명: {lighting}\n"
|
300 |
+
if texture and texture != "선택 안함":
|
301 |
preview += f"배경 질감: {texture}\n"
|
302 |
+
if color_tone and color_tone != "선택 안함":
|
303 |
preview += f"색감: {color_tone}\n"
|
304 |
+
if mood and mood != "선택 안함":
|
305 |
preview += f"분위기: {mood}\n"
|
306 |
|
307 |
return preview
|
|
|
388 |
|
389 |
# 배경 질감 드롭다운
|
390 |
texture = gr.Dropdown(
|
391 |
+
choices=["선택 안함", "흰 벽", "대리석", "나무", "벽돌", "흰 천", "시멘트"],
|
392 |
label="배경 질감 선택",
|
393 |
+
value="선택 안함",
|
394 |
visible=False
|
395 |
)
|
396 |
|
397 |
# 색감 드롭다운
|
398 |
color_tone = gr.Dropdown(
|
399 |
+
choices=["선택 안함", "화이트 톤", "블루 톤", "따뜻한 색상", "모노톤", "파스텔"],
|
400 |
label="색감 선택",
|
401 |
+
value="선택 안함",
|
402 |
visible=False
|
403 |
)
|
404 |
|
405 |
# 분위기 드롭다운
|
406 |
mood = gr.Dropdown(
|
407 |
+
choices=["선택 안함", "포근한", "심플한", "모던한", "내추럴", "미니멀"],
|
408 |
label="분위기 선택",
|
409 |
+
value="선택 안함",
|
410 |
visible=False
|
411 |
)
|
412 |
|
|
|
414 |
selection_preview = gr.Textbox(
|
415 |
label="선택 내용 미리보기",
|
416 |
lines=8,
|
417 |
+
interactive=False,
|
418 |
visible=False
|
419 |
)
|
420 |
|
|
|
566 |
outputs=[output_image, output_text, prompt_display, options_summary, kr_prompt_display],
|
567 |
)
|
568 |
|
|
|
569 |
gr.Markdown(
|
570 |
"""
|
571 |
### 사용 방법:
|