seawolf2357 commited on
Commit
5968142
·
verified ·
1 Parent(s): 9a43807

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -20
app.py CHANGED
@@ -143,6 +143,7 @@ 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
  # 메인 컨텐츠를 위한 Row
@@ -165,18 +166,6 @@ with gr.Blocks(css_paths="app.css") as demo:
165
  btn = antd.Button("send", type="primary", size="large")
166
  clear_btn = antd.Button("clear history", type="default", size="large")
167
 
168
- # Examples 섹션을 여기로 이동
169
- antd.Divider("examples")
170
- with antd.Flex(vertical=True, gap="small"):
171
- for demo in DEMO_LIST:
172
- with antd.Card(hoverable=True) as demoCard:
173
- antd.CardMeta(title=demo.get('title', 'Example'))
174
- demoCard.click(
175
- fn=lambda x, d=demo: d['description'],
176
- inputs=[gr.State(None)],
177
- outputs=[input]
178
- )
179
-
180
  # Modal과 Drawer 컴포넌트들
181
  with antd.Modal(open=False, title="set system Prompt", width="800px") as system_prompt_modal:
182
  systemPromptInput = antd.InputTextarea(
@@ -201,11 +190,22 @@ with gr.Blocks(css_paths="app.css") as demo:
201
  with antd.Tabs(active_key="empty", render_tab_bar="() => null") as state_tab:
202
  with antd.Tabs.Item(key="empty"):
203
  empty = antd.Empty(description="empty input", elem_classes="right_content")
204
- with antd.Tabs.Item(key="loading"):
205
- loading = antd.Spin(True, tip="coding...", size="large", elem_classes="right_content")
206
- with antd.Tabs.Item(key="render"):
207
- sandbox = gr.HTML(elem_classes="html_content")
208
-
 
 
 
 
 
 
 
 
 
 
 
209
  # 버튼 이벤트 핸들러
210
  settingPromptBtn.click(lambda: gr.update(
211
  open=True), inputs=[], outputs=[system_prompt_modal])
@@ -231,8 +231,6 @@ with gr.Blocks(css_paths="app.css") as demo:
231
 
232
  clear_btn.click(clear_history, inputs=[], outputs=[history])
233
 
 
234
  if __name__ == "__main__":
235
- demo = gr.Blocks(css_paths="app.css")
236
- with demo:
237
- app
238
  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
+
147
  with ms.Application() as app:
148
  with antd.ConfigProvider():
149
  # 메인 컨텐츠를 위한 Row
 
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(
 
190
  with antd.Tabs(active_key="empty", render_tab_bar="() => null") as state_tab:
191
  with antd.Tabs.Item(key="empty"):
192
  empty = antd.Empty(description="empty input", elem_classes="right_content")
193
+ with antd.Tabs.Item(key="loading"):
194
+ loading = antd.Spin(True, tip="coding...", size="large", elem_classes="right_content")
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])
 
231
 
232
  clear_btn.click(clear_history, inputs=[], outputs=[history])
233
 
234
+
235
  if __name__ == "__main__":
 
 
 
236
  demo.queue(default_concurrency_limit=20).launch(ssr_mode=False)