Update app.py
Browse files
app.py
CHANGED
@@ -131,8 +131,7 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
131 |
except Exception as e:
|
132 |
print(f"Error details: {str(e)}") # ๋๋ฒ๊น
์ ์ํ ์๋ฌ ์ถ๋ ฅ
|
133 |
raise ValueError(f'Error calling Claude API: {str(e)}')
|
134 |
-
|
135 |
-
|
136 |
with ms.Application() as app:
|
137 |
with antd.ConfigProvider():
|
138 |
# ๋ฉ์ธ ์ปจํ
์ธ ๋ฅผ ์ํ Row
|
@@ -201,12 +200,7 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
201 |
outputs=[input]
|
202 |
)
|
203 |
|
204 |
-
|
205 |
-
# Modal๊ณผ Drawer ์ปดํฌ๋ํธ๋ค
|
206 |
-
with antd.Modal(open=False, title="set system Prompt", width="800px") as system_prompt_modal:
|
207 |
-
systemPromptInput = antd.InputTextarea(
|
208 |
-
SystemPrompt, auto_size=True)
|
209 |
-
|
210 |
with antd.Drawer(open=False, title="code", placement="left", width="750px") as code_drawer:
|
211 |
code_output = legacy.Markdown()
|
212 |
|
@@ -217,8 +211,6 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
217 |
with antd.Col(span=24, md=16):
|
218 |
with ms.Div(elem_classes="right_panel"):
|
219 |
with antd.Flex(gap="small", elem_classes="setting-buttons"):
|
220 |
-
# settingPromptBtn = antd.Button(
|
221 |
-
# "โ๏ธ set system Prompt", type="default")
|
222 |
codeBtn = antd.Button("๐งโ๐ป view code", type="default")
|
223 |
historyBtn = antd.Button("๐ history", type="default")
|
224 |
|
@@ -231,8 +223,7 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
231 |
with antd.Tabs.Item(key="render"):
|
232 |
sandbox = gr.HTML(elem_classes="html_content")
|
233 |
|
234 |
-
|
235 |
-
# Code ์คํ ๋ฒํผ ์ด๋ฒคํธ ํธ๋ค๋ฌ
|
236 |
def execute_code(query: str):
|
237 |
if not query or query.strip() == '':
|
238 |
return None, gr.update(active_key="empty")
|
@@ -251,20 +242,13 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
251 |
print(f"Error executing code: {str(e)}")
|
252 |
return None, gr.update(active_key="empty")
|
253 |
|
254 |
-
#
|
255 |
execute_btn.click(
|
256 |
fn=execute_code,
|
257 |
inputs=[input],
|
258 |
outputs=[sandbox, state_tab]
|
259 |
)
|
260 |
|
261 |
-
settingPromptBtn.click(lambda: gr.update(
|
262 |
-
open=True), inputs=[], outputs=[system_prompt_modal])
|
263 |
-
system_prompt_modal.ok(lambda input: ({"system": input}, gr.update(
|
264 |
-
open=False)), inputs=[systemPromptInput], outputs=[setting, system_prompt_modal])
|
265 |
-
system_prompt_modal.cancel(lambda: gr.update(
|
266 |
-
open=False), outputs=[system_prompt_modal])
|
267 |
-
|
268 |
codeBtn.click(lambda: gr.update(open=True),
|
269 |
inputs=[], outputs=[code_drawer])
|
270 |
code_drawer.close(lambda: gr.update(
|
@@ -282,6 +266,5 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
282 |
|
283 |
clear_btn.click(clear_history, inputs=[], outputs=[history])
|
284 |
|
285 |
-
|
286 |
if __name__ == "__main__":
|
287 |
demo.queue(default_concurrency_limit=20).launch(ssr_mode=False)
|
|
|
131 |
except Exception as e:
|
132 |
print(f"Error details: {str(e)}") # ๋๋ฒ๊น
์ ์ํ ์๋ฌ ์ถ๋ ฅ
|
133 |
raise ValueError(f'Error calling Claude API: {str(e)}')
|
134 |
+
|
|
|
135 |
with ms.Application() as app:
|
136 |
with antd.ConfigProvider():
|
137 |
# ๋ฉ์ธ ์ปจํ
์ธ ๋ฅผ ์ํ Row
|
|
|
200 |
outputs=[input]
|
201 |
)
|
202 |
|
203 |
+
# Drawer ์ปดํฌ๋ํธ๋ค
|
|
|
|
|
|
|
|
|
|
|
204 |
with antd.Drawer(open=False, title="code", placement="left", width="750px") as code_drawer:
|
205 |
code_output = legacy.Markdown()
|
206 |
|
|
|
211 |
with antd.Col(span=24, md=16):
|
212 |
with ms.Div(elem_classes="right_panel"):
|
213 |
with antd.Flex(gap="small", elem_classes="setting-buttons"):
|
|
|
|
|
214 |
codeBtn = antd.Button("๐งโ๐ป view code", type="default")
|
215 |
historyBtn = antd.Button("๐ history", type="default")
|
216 |
|
|
|
223 |
with antd.Tabs.Item(key="render"):
|
224 |
sandbox = gr.HTML(elem_classes="html_content")
|
225 |
|
226 |
+
# Code ์คํ ๋ฒํผ ์ด๋ฒคํธ ํธ๋ค๋ฌ
|
|
|
227 |
def execute_code(query: str):
|
228 |
if not query or query.strip() == '':
|
229 |
return None, gr.update(active_key="empty")
|
|
|
242 |
print(f"Error executing code: {str(e)}")
|
243 |
return None, gr.update(active_key="empty")
|
244 |
|
245 |
+
# ์ด๋ฒคํธ ํธ๋ค๋ฌ๋ค
|
246 |
execute_btn.click(
|
247 |
fn=execute_code,
|
248 |
inputs=[input],
|
249 |
outputs=[sandbox, state_tab]
|
250 |
)
|
251 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
codeBtn.click(lambda: gr.update(open=True),
|
253 |
inputs=[], outputs=[code_drawer])
|
254 |
code_drawer.close(lambda: gr.update(
|
|
|
266 |
|
267 |
clear_btn.click(clear_history, inputs=[], outputs=[history])
|
268 |
|
|
|
269 |
if __name__ == "__main__":
|
270 |
demo.queue(default_concurrency_limit=20).launch(ssr_mode=False)
|