littlebird13
commited on
Commit
•
147e798
1
Parent(s):
115f611
Update app.py
Browse files
app.py
CHANGED
@@ -49,6 +49,8 @@ def remove_code_block(text):
|
|
49 |
def history_render(history: History):
|
50 |
return gr.update(open=True), history
|
51 |
|
|
|
|
|
52 |
|
53 |
def send_to_sandbox(code):
|
54 |
encoded_html = base64.b64encode(code.encode('utf-8')).decode('utf-8')
|
@@ -96,7 +98,7 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
96 |
# size="large", allow_clear=True, show_count=True, placeholder="请输入您想要一个什么样的应用")
|
97 |
input = gr.TextArea(placeholder="Please enter what kind of application you want", show_label=False, container=False)
|
98 |
btn = antd.Button("send", type="primary", size="large")
|
99 |
-
|
100 |
antd.Divider("examples")
|
101 |
with antd.Flex(gap="small", wrap=True):
|
102 |
with ms.Each(DEMO_LIST):
|
@@ -197,6 +199,8 @@ with gr.Blocks(css_paths="app.css") as demo:
|
|
197 |
btn.click(generation_code,
|
198 |
inputs=[input, setting, history],
|
199 |
outputs=[code_output, history, sandbox, state_tab, code_drawer])
|
200 |
-
|
|
|
|
|
201 |
if __name__ == "__main__":
|
202 |
demo.queue(default_concurrency_limit=20).launch(ssr_mode=False)
|
|
|
49 |
def history_render(history: History):
|
50 |
return gr.update(open=True), history
|
51 |
|
52 |
+
def clear_history():
|
53 |
+
return []
|
54 |
|
55 |
def send_to_sandbox(code):
|
56 |
encoded_html = base64.b64encode(code.encode('utf-8')).decode('utf-8')
|
|
|
98 |
# size="large", allow_clear=True, show_count=True, placeholder="请输入您想要一个什么样的应用")
|
99 |
input = gr.TextArea(placeholder="Please enter what kind of application you want", show_label=False, container=False)
|
100 |
btn = antd.Button("send", type="primary", size="large")
|
101 |
+
clear_btn = antd.Button("clear history", type="default", size="large")
|
102 |
antd.Divider("examples")
|
103 |
with antd.Flex(gap="small", wrap=True):
|
104 |
with ms.Each(DEMO_LIST):
|
|
|
199 |
btn.click(generation_code,
|
200 |
inputs=[input, setting, history],
|
201 |
outputs=[code_output, history, sandbox, state_tab, code_drawer])
|
202 |
+
|
203 |
+
clear_btn.click(clear_history, inputs=[], outputs=[history])
|
204 |
+
|
205 |
if __name__ == "__main__":
|
206 |
demo.queue(default_concurrency_limit=20).launch(ssr_mode=False)
|