Update app.py
Browse files
app.py
CHANGED
@@ -96,13 +96,7 @@ def create_app():
|
|
96 |
gr.HTML(fontawesome_link)
|
97 |
with gr.Tabs():
|
98 |
with gr.TabItem("예시 결과 보기"):
|
99 |
-
|
100 |
-
gr.HTML('<div class="section-title"><img src="https://cdn-icons-png.flaticon.com/512/681/681443.png"> 상품 배경 이미지 예시 갤러리</div>')
|
101 |
-
with gr.Row(elem_classes="example-gallery"):
|
102 |
-
for idx, ex in enumerate(product_background_examples):
|
103 |
-
item = gr.Image(value=ex[5], show_label=False, elem_classes="example-item")
|
104 |
-
item.select(fn=load_example, inputs=None, outputs=[example_input_image, example_bg_type, example_bg_option, example_product_name, example_additional_info, example_output_image], _js=None)
|
105 |
-
# 메인 뷰
|
106 |
with gr.Row():
|
107 |
example_input_image = gr.Image(label="입력 이미지", elem_classes="image-container")
|
108 |
with gr.Column():
|
@@ -111,7 +105,29 @@ def create_app():
|
|
111 |
example_product_name = gr.Textbox(label="상품명", interactive=False)
|
112 |
example_additional_info = gr.Textbox(label="추가 요청사항", interactive=False)
|
113 |
example_output_image = gr.Image(label="결과 이미지", elem_classes="image-container")
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
return demo
|
116 |
|
117 |
if __name__ == "__main__":
|
|
|
96 |
gr.HTML(fontawesome_link)
|
97 |
with gr.Tabs():
|
98 |
with gr.TabItem("예시 결과 보기"):
|
99 |
+
# 메인 뷰 컴포넌트 먼저 정의
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
with gr.Row():
|
101 |
example_input_image = gr.Image(label="입력 이미지", elem_classes="image-container")
|
102 |
with gr.Column():
|
|
|
105 |
example_product_name = gr.Textbox(label="상품명", interactive=False)
|
106 |
example_additional_info = gr.Textbox(label="추가 요청사항", interactive=False)
|
107 |
example_output_image = gr.Image(label="결과 이미지", elem_classes="image-container")
|
108 |
+
|
109 |
+
# 예시 갤러리
|
110 |
+
with gr.Column():
|
111 |
+
gr.HTML('<div class="section-title"><img src="https://cdn-icons-png.flaticon.com/512/681/681443.png"> 상품 배경 이미지 예시 갤러리</div>')
|
112 |
+
with gr.Row(elem_classes="example-gallery"):
|
113 |
+
for idx, ex in enumerate(product_background_examples):
|
114 |
+
item = gr.Image(value=ex[5], show_label=False, elem_classes="example-item")
|
115 |
+
item.select(fn=load_example, inputs=None,
|
116 |
+
outputs=[example_input_image,
|
117 |
+
example_bg_type,
|
118 |
+
example_bg_option,
|
119 |
+
example_product_name,
|
120 |
+
example_additional_info,
|
121 |
+
example_output_image])
|
122 |
+
|
123 |
+
# 첫 번째 예시 자동 로드
|
124 |
+
demo.load(fn=load_first_example,
|
125 |
+
outputs=[example_input_image,
|
126 |
+
example_bg_type,
|
127 |
+
example_bg_option,
|
128 |
+
example_product_name,
|
129 |
+
example_additional_info,
|
130 |
+
example_output_image])
|
131 |
return demo
|
132 |
|
133 |
if __name__ == "__main__":
|