seawolf2357 commited on
Commit
381975c
ยท
verified ยท
1 Parent(s): be9a586

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -20
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: # style ๋Œ€์‹  elem_classes ์‚ฌ์šฉ
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(justify="center", elem_classes="examples-container"):
191
  with antd.Col(span=24):
192
  antd.Divider("examples")
193
- with antd.Row(gutter=[16, 16], justify="start"):
194
- with ms.Each(DEMO_LIST):
195
- with antd.Col(xs=24, sm=12, md=8): # ๋ฐ˜์‘ํ˜• ๊ทธ๋ฆฌ๋“œ
196
- with antd.Card(hoverable=True, as_item="card") as demoCard:
197
- antd.CardMeta()
198
- demoCard.click(demo_card_click, outputs=[input])
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)