Update app.py
Browse files
app.py
CHANGED
@@ -1001,6 +1001,7 @@ with gr.Blocks(
|
|
1001 |
def update_ui_language(language):
|
1002 |
"""UI ์ธ์ด ์
๋ฐ์ดํธ"""
|
1003 |
texts = TEXTS[language]
|
|
|
1004 |
return (
|
1005 |
language, # current_language state update
|
1006 |
# Title section update
|
@@ -1047,7 +1048,7 @@ with gr.Blocks(
|
|
1047 |
industry_input = gr.Textbox(
|
1048 |
label="๐ญ Industry",
|
1049 |
placeholder="e.g., cafe, fitness, education, beauty...",
|
1050 |
-
value=""
|
1051 |
)
|
1052 |
|
1053 |
keywords_input = gr.Textbox(
|
@@ -1120,11 +1121,32 @@ with gr.Blocks(
|
|
1120 |
with gr.Column():
|
1121 |
# ํ๋ก๊ทธ๋ ์ค ๋ฉ์์ง
|
1122 |
progress_msg = gr.Markdown(
|
1123 |
-
visible=False
|
1124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1125 |
<div style="text-align: center; padding: 20px; background: #f0f8ff; border-radius: 10px; margin: 10px 0;">
|
1126 |
<div class="progress-bar" style="font-size: 1.2em; color: #1976d2;">
|
1127 |
-
|
1128 |
</div>
|
1129 |
<div style="margin-top: 10px;">
|
1130 |
<div style="width: 100%; background: #e0e0e0; border-radius: 5px; overflow: hidden;">
|
@@ -1139,32 +1161,21 @@ with gr.Blocks(
|
|
1139 |
}}
|
1140 |
</style>
|
1141 |
"""
|
1142 |
-
|
1143 |
|
1144 |
-
|
1145 |
-
|
1146 |
-
f"Generate with {tab_name}",
|
1147 |
-
variant="primary",
|
1148 |
-
size="lg",
|
1149 |
-
elem_id=f"btn_{theory_key}"
|
1150 |
-
)
|
1151 |
-
|
1152 |
-
output = gr.Markdown()
|
1153 |
-
visual = gr.HTML()
|
1154 |
-
|
1155 |
-
def generate_with_progress(industry, keywords, theory, language):
|
1156 |
-
"""ํ๋ก๊ทธ๋ ์ค๋ฐ์ ํจ๊ป ์์ฑ"""
|
1157 |
-
# ๋จผ์ ํ๋ก๊ทธ๋ ์ค๋ฐ ํ์
|
1158 |
-
yield "", "", gr.update(visible=True)
|
1159 |
-
|
1160 |
-
# ์ค์ ์์ฑ ์์
|
1161 |
result_md, result_html, _ = generate_by_theory(industry, keywords, theory, language)
|
1162 |
-
|
1163 |
-
# ๊ฒฐ๊ณผ ๋ฐํ ๋ฐ ํ๋ก๊ทธ๋ ์ค๋ฐ ์จ๊น
|
1164 |
-
yield result_md, result_html, gr.update(visible=False)
|
1165 |
|
|
|
1166 |
btn.click(
|
1167 |
-
lambda i, k, l, t=theory_key:
|
|
|
|
|
|
|
|
|
|
|
1168 |
inputs=[industry_input, keywords_input, current_language],
|
1169 |
outputs=[output, visual, progress_msg]
|
1170 |
)
|
|
|
1001 |
def update_ui_language(language):
|
1002 |
"""UI ์ธ์ด ์
๋ฐ์ดํธ"""
|
1003 |
texts = TEXTS[language]
|
1004 |
+
|
1005 |
return (
|
1006 |
language, # current_language state update
|
1007 |
# Title section update
|
|
|
1048 |
industry_input = gr.Textbox(
|
1049 |
label="๐ญ Industry",
|
1050 |
placeholder="e.g., cafe, fitness, education, beauty...",
|
1051 |
+
value="์นดํ/์ปคํผ์"
|
1052 |
)
|
1053 |
|
1054 |
keywords_input = gr.Textbox(
|
|
|
1121 |
with gr.Column():
|
1122 |
# ํ๋ก๊ทธ๋ ์ค ๋ฉ์์ง
|
1123 |
progress_msg = gr.Markdown(
|
1124 |
+
visible=False
|
1125 |
+
)
|
1126 |
+
|
1127 |
+
with gr.Row():
|
1128 |
+
btn = gr.Button(
|
1129 |
+
f"Generate with {tab_name}",
|
1130 |
+
variant="primary",
|
1131 |
+
size="lg",
|
1132 |
+
elem_id=f"btn_{theory_key}"
|
1133 |
+
)
|
1134 |
+
|
1135 |
+
output = gr.Markdown()
|
1136 |
+
visual = gr.HTML()
|
1137 |
+
|
1138 |
+
def show_progress(industry, keywords, theory, language, tab_name):
|
1139 |
+
"""ํ๋ก๊ทธ๋ ์ค๋ฐ ํ์"""
|
1140 |
+
if not industry or not keywords:
|
1141 |
+
return "", "", gr.update(visible=False)
|
1142 |
+
|
1143 |
+
texts = TEXTS[language]
|
1144 |
+
progress_text = texts["progress_message"].format(theory=tab_name)
|
1145 |
+
|
1146 |
+
progress_html = f"""
|
1147 |
<div style="text-align: center; padding: 20px; background: #f0f8ff; border-radius: 10px; margin: 10px 0;">
|
1148 |
<div class="progress-bar" style="font-size: 1.2em; color: #1976d2;">
|
1149 |
+
{progress_text}
|
1150 |
</div>
|
1151 |
<div style="margin-top: 10px;">
|
1152 |
<div style="width: 100%; background: #e0e0e0; border-radius: 5px; overflow: hidden;">
|
|
|
1161 |
}}
|
1162 |
</style>
|
1163 |
"""
|
1164 |
+
return "", "", gr.update(visible=True, value=progress_html)
|
1165 |
|
1166 |
+
def generate_and_hide_progress(industry, keywords, theory, language):
|
1167 |
+
"""์์ฑ ํ ํ๋ก๊ทธ๋ ์ค๋ฐ ์จ๊น"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1168 |
result_md, result_html, _ = generate_by_theory(industry, keywords, theory, language)
|
1169 |
+
return result_md, result_html, gr.update(visible=False)
|
|
|
|
|
1170 |
|
1171 |
+
# ํ๋ก๊ทธ๋ ์ค๋ฐ ํ์
|
1172 |
btn.click(
|
1173 |
+
lambda i, k, l, t=theory_key, n=tab_name: show_progress(i, k, t, l, n),
|
1174 |
+
inputs=[industry_input, keywords_input, current_language],
|
1175 |
+
outputs=[output, visual, progress_msg]
|
1176 |
+
).then(
|
1177 |
+
# ์ค์ ์์ฑ ์์
|
1178 |
+
lambda i, k, l, t=theory_key: generate_and_hide_progress(i, k, t, l),
|
1179 |
inputs=[industry_input, keywords_input, current_language],
|
1180 |
outputs=[output, visual, progress_msg]
|
1181 |
)
|