Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -143,11 +143,10 @@ 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 |
-
|
147 |
with ms.Application() as app:
|
148 |
with antd.ConfigProvider():
|
149 |
# ๋ฉ์ธ ์ปจํ
์ธ ์์ญ
|
150 |
-
with antd.Row(gutter=[32, 12], elem_classes="main-content") as layout:
|
151 |
# ์ข์ธก ํจ๋
|
152 |
with antd.Col(span=24, md=8):
|
153 |
with antd.Flex(vertical=True, gap="middle", wrap=True):
|
@@ -168,15 +167,16 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
168 |
|
169 |
# ์ฐ์ธก ํจ๋
|
170 |
with antd.Col(span=24, md=16):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
with ms.Div(elem_classes="right_panel"):
|
172 |
-
# Setting ๋ฒํผ๋ค์ ์ฐ์ธก ์๋จ์ ๋ฐฐ์น
|
173 |
-
with antd.Row(justify="end", elem_classes="setting-buttons-container"):
|
174 |
-
with antd.Space(size="small"):
|
175 |
-
settingPromptBtn = antd.Button(
|
176 |
-
"โ๏ธ set system Prompt", type="default")
|
177 |
-
codeBtn = antd.Button("๐งโ๐ป view code", type="default")
|
178 |
-
historyBtn = antd.Button("๐ history", type="default")
|
179 |
-
|
180 |
gr.HTML('<div class="render_header"><span class="header_btn"></span><span class="header_btn"></span><span class="header_btn"></span></div>')
|
181 |
with antd.Tabs(active_key="empty", render_tab_bar="() => null") as state_tab:
|
182 |
with antd.Tabs.Item(key="empty"):
|
@@ -186,16 +186,16 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
186 |
with antd.Tabs.Item(key="render"):
|
187 |
sandbox = gr.HTML(elem_classes="html_content")
|
188 |
|
189 |
-
# Examples
|
190 |
-
with antd.Row(
|
191 |
with antd.Col(span=24):
|
192 |
antd.Divider("examples")
|
193 |
-
with antd.Row(
|
194 |
-
|
195 |
-
with antd.Col(
|
196 |
-
with antd.Card(hoverable=True
|
197 |
-
antd.CardMeta()
|
198 |
-
demoCard.click(
|
199 |
|
200 |
# Modal๊ณผ Drawer ์ปดํฌ๋ํธ๋ค
|
201 |
with antd.Modal(open=False, title="set system Prompt", width="800px") as system_prompt_modal:
|
@@ -208,7 +208,6 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
208 |
with antd.Drawer(open=False, title="history", placement="left", width="900px") as history_drawer:
|
209 |
history_output = legacy.Chatbot(show_label=False, flushing=False, height=960, elem_classes="history_chatbot")
|
210 |
|
211 |
-
|
212 |
# ๋ฒํผ ์ด๋ฒคํธ ํธ๋ค๋ฌ
|
213 |
settingPromptBtn.click(lambda: gr.update(
|
214 |
open=True), inputs=[], outputs=[system_prompt_modal])
|
@@ -234,6 +233,5 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
234 |
|
235 |
clear_btn.click(clear_history, inputs=[], outputs=[history])
|
236 |
|
237 |
-
|
238 |
if __name__ == "__main__":
|
239 |
demo.queue(default_concurrency_limit=20).launch(ssr_mode=False)
|
|
|
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 |
# ๋ฉ์ธ ์ปจํ
์ธ ์์ญ
|
149 |
+
with antd.Row(gutter=[32, 12], elem_classes="main-content") as layout:
|
150 |
# ์ข์ธก ํจ๋
|
151 |
with antd.Col(span=24, md=8):
|
152 |
with antd.Flex(vertical=True, gap="middle", wrap=True):
|
|
|
167 |
|
168 |
# ์ฐ์ธก ํจ๋
|
169 |
with antd.Col(span=24, md=16):
|
170 |
+
# Setting ๋ฒํผ๋ค์ ์ฐ์ธก ์๋จ์ ๋ณ๋๋ก ๋ฐฐ์น
|
171 |
+
with antd.Row(justify="end", elem_classes="setting-buttons-row"):
|
172 |
+
with antd.Space(size="small"):
|
173 |
+
settingPromptBtn = antd.Button(
|
174 |
+
"โ๏ธ set system Prompt", type="default")
|
175 |
+
codeBtn = antd.Button("๐งโ๐ป view code", type="default")
|
176 |
+
historyBtn = antd.Button("๐ history", type="default")
|
177 |
+
|
178 |
+
# ์น ์ถ๋ ฅ ํจ๋
|
179 |
with ms.Div(elem_classes="right_panel"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
gr.HTML('<div class="render_header"><span class="header_btn"></span><span class="header_btn"></span><span class="header_btn"></span></div>')
|
181 |
with antd.Tabs(active_key="empty", render_tab_bar="() => null") as state_tab:
|
182 |
with antd.Tabs.Item(key="empty"):
|
|
|
186 |
with antd.Tabs.Item(key="render"):
|
187 |
sandbox = gr.HTML(elem_classes="html_content")
|
188 |
|
189 |
+
# Examples ์น์
|
190 |
+
with antd.Row(elem_classes="examples-section"):
|
191 |
with antd.Col(span=24):
|
192 |
antd.Divider("examples")
|
193 |
+
with antd.Row():
|
194 |
+
for idx, demo in enumerate(DEMO_LIST):
|
195 |
+
with antd.Col(span=8):
|
196 |
+
with antd.Card(hoverable=True) as demoCard:
|
197 |
+
antd.CardMeta(title=f"Example {idx + 1}")
|
198 |
+
demoCard.click(lambda e, idx=idx: DEMO_LIST[idx]['description'], outputs=[input])
|
199 |
|
200 |
# Modal๊ณผ Drawer ์ปดํฌ๋ํธ๋ค
|
201 |
with antd.Modal(open=False, title="set system Prompt", width="800px") as system_prompt_modal:
|
|
|
208 |
with antd.Drawer(open=False, title="history", placement="left", width="900px") as history_drawer:
|
209 |
history_output = legacy.Chatbot(show_label=False, flushing=False, height=960, elem_classes="history_chatbot")
|
210 |
|
|
|
211 |
# ๋ฒํผ ์ด๋ฒคํธ ํธ๋ค๋ฌ
|
212 |
settingPromptBtn.click(lambda: gr.update(
|
213 |
open=True), inputs=[], outputs=[system_prompt_modal])
|
|
|
233 |
|
234 |
clear_btn.click(clear_history, inputs=[], outputs=[history])
|
235 |
|
|
|
236 |
if __name__ == "__main__":
|
237 |
demo.queue(default_concurrency_limit=20).launch(ssr_mode=False)
|