Spaces:
Running
Running
Update app-backup1.py
Browse files- app-backup1.py +15 -8
app-backup1.py
CHANGED
@@ -143,9 +143,12 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
143 |
except Exception as e:
|
144 |
raise ValueError(f'Error calling Claude API: {str(e)}')
|
145 |
|
|
|
146 |
with ms.Application() as app:
|
147 |
with antd.ConfigProvider():
|
|
|
148 |
with antd.Row(gutter=[32, 12]) as layout:
|
|
|
149 |
with antd.Col(span=24, md=8):
|
150 |
with antd.Flex(vertical=True, gap="middle", wrap=True):
|
151 |
header = gr.HTML(f"""
|
@@ -163,13 +166,6 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
163 |
btn = antd.Button("send", type="primary", size="large")
|
164 |
clear_btn = antd.Button("clear history", type="default", size="large")
|
165 |
|
166 |
-
antd.Divider("examples")
|
167 |
-
with antd.Flex(gap="small", wrap=True):
|
168 |
-
with ms.Each(DEMO_LIST):
|
169 |
-
with antd.Card(hoverable=True, as_item="card") as demoCard:
|
170 |
-
antd.CardMeta()
|
171 |
-
demoCard.click(demo_card_click, outputs=[input])
|
172 |
-
|
173 |
# Modal과 Drawer 컴포넌트들
|
174 |
with antd.Modal(open=False, title="set system Prompt", width="800px") as system_prompt_modal:
|
175 |
systemPromptInput = antd.InputTextarea(
|
@@ -181,9 +177,9 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
181 |
with antd.Drawer(open=False, title="history", placement="left", width="900px") as history_drawer:
|
182 |
history_output = legacy.Chatbot(show_label=False, flushing=False, height=960, elem_classes="history_chatbot")
|
183 |
|
|
|
184 |
with antd.Col(span=24, md=16):
|
185 |
with ms.Div(elem_classes="right_panel"):
|
186 |
-
# 우측 상단에 setting 버튼들 추가
|
187 |
with antd.Flex(gap="small", elem_classes="setting-buttons"):
|
188 |
settingPromptBtn = antd.Button(
|
189 |
"⚙️ set system Prompt", type="default")
|
@@ -199,6 +195,17 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
199 |
with antd.Tabs.Item(key="render"):
|
200 |
sandbox = gr.HTML(elem_classes="html_content")
|
201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
# 버튼 이벤트 핸들러
|
203 |
settingPromptBtn.click(lambda: gr.update(
|
204 |
open=True), inputs=[], outputs=[system_prompt_modal])
|
|
|
143 |
except Exception as e:
|
144 |
raise ValueError(f'Error calling Claude API: {str(e)}')
|
145 |
|
146 |
+
|
147 |
with ms.Application() as app:
|
148 |
with antd.ConfigProvider():
|
149 |
+
# 메인 컨텐츠를 위한 Row
|
150 |
with antd.Row(gutter=[32, 12]) as layout:
|
151 |
+
# 좌측 패널
|
152 |
with antd.Col(span=24, md=8):
|
153 |
with antd.Flex(vertical=True, gap="middle", wrap=True):
|
154 |
header = gr.HTML(f"""
|
|
|
166 |
btn = antd.Button("send", type="primary", size="large")
|
167 |
clear_btn = antd.Button("clear history", type="default", size="large")
|
168 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
# Modal과 Drawer 컴포넌트들
|
170 |
with antd.Modal(open=False, title="set system Prompt", width="800px") as system_prompt_modal:
|
171 |
systemPromptInput = antd.InputTextarea(
|
|
|
177 |
with antd.Drawer(open=False, title="history", placement="left", width="900px") as history_drawer:
|
178 |
history_output = legacy.Chatbot(show_label=False, flushing=False, height=960, elem_classes="history_chatbot")
|
179 |
|
180 |
+
# 우측 패널
|
181 |
with antd.Col(span=24, md=16):
|
182 |
with ms.Div(elem_classes="right_panel"):
|
|
|
183 |
with antd.Flex(gap="small", elem_classes="setting-buttons"):
|
184 |
settingPromptBtn = antd.Button(
|
185 |
"⚙️ set system Prompt", type="default")
|
|
|
195 |
with antd.Tabs.Item(key="render"):
|
196 |
sandbox = gr.HTML(elem_classes="html_content")
|
197 |
|
198 |
+
# Examples 섹션을 별도의 Row로 추가 (전체 화면 하단)
|
199 |
+
with antd.Row(gutter=[0, 24], elem_classes="examples-section"):
|
200 |
+
with antd.Col(span=24):
|
201 |
+
antd.Divider("examples")
|
202 |
+
with antd.Row(gutter=[16, 16]):
|
203 |
+
with ms.Each(DEMO_LIST):
|
204 |
+
with antd.Col(span=8): # 한 줄에 3개씩 (24/3 = 8)
|
205 |
+
with antd.Card(hoverable=True, as_item="card") as demoCard:
|
206 |
+
antd.CardMeta()
|
207 |
+
demoCard.click(demo_card_click, outputs=[input])
|
208 |
+
|
209 |
# 버튼 이벤트 핸들러
|
210 |
settingPromptBtn.click(lambda: gr.update(
|
211 |
open=True), inputs=[], outputs=[system_prompt_modal])
|