littlebird13 commited on
Commit
115f611
1 Parent(s): 4237a22

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -94,25 +94,25 @@ with gr.Blocks(css_paths="app.css") as demo:
94
  """)
95
  # input = antd.InputTextarea(
96
  # size="large", allow_clear=True, show_count=True, placeholder="请输入您想要一个什么样的应用")
97
- input = gr.TextArea(placeholder="请输入您想要一个什么样的应用", show_label=False, container=False)
98
- btn = antd.Button("生成", type="primary", size="large")
99
 
100
- antd.Divider("示例")
101
  with antd.Flex(gap="small", wrap=True):
102
  with ms.Each(DEMO_LIST):
103
  with antd.Card(hoverable=True, as_item="card") as demoCard:
104
  antd.CardMeta()
105
  demoCard.click(demo_card_click, outputs=[input])
106
 
107
- antd.Divider("设置")
108
 
109
  with antd.Flex(gap="small", wrap=True):
110
  settingPromptBtn = antd.Button(
111
- "⚙️ 设置系统 Prompt", type="default")
112
- codeBtn = antd.Button("🧑‍💻 查看代码", type="default")
113
- historyBtn = antd.Button("📜 历史记录", type="default")
114
 
115
- with antd.Modal(open=False, title="设置系统 Prompt", width="800px") as system_prompt_modal:
116
  systemPromptInput = antd.InputTextarea(
117
  SystemPrompt, auto_size=True)
118
 
@@ -123,7 +123,7 @@ with gr.Blocks(css_paths="app.css") as demo:
123
  system_prompt_modal.cancel(lambda: gr.update(
124
  open=False), outputs=[system_prompt_modal])
125
 
126
- with antd.Drawer(open=False, title="代码", placement="left", width="750px") as code_drawer:
127
  code_output = legacy.Markdown()
128
 
129
  codeBtn.click(lambda: gr.update(open=True),
@@ -131,7 +131,7 @@ with gr.Blocks(css_paths="app.css") as demo:
131
  code_drawer.close(lambda: gr.update(
132
  open=False), inputs=[], outputs=[code_drawer])
133
 
134
- with antd.Drawer(open=False, title="历史记录", placement="left", width="900px") as history_drawer:
135
  history_output = legacy.Chatbot(show_label=False, flushing=False, height=960, elem_classes="history_chatbot")
136
 
137
  historyBtn.click(history_render, inputs=[history], outputs=[history_drawer, history_output])
@@ -142,9 +142,9 @@ with gr.Blocks(css_paths="app.css") as demo:
142
  gr.HTML('<div class="render_header"><span class="header_btn"></span><span class="header_btn"></span><span class="header_btn"></span></div>')
143
  with antd.Tabs(active_key="empty", render_tab_bar="() => null") as state_tab:
144
  with antd.Tabs.Item(key="empty"):
145
- empty = antd.Empty(description="请在左侧输入您需要的界面后生成", elem_classes="right_content")
146
  with antd.Tabs.Item(key="loading"):
147
- loading = antd.Spin(True, tip="正在生成代码中...", size="large", elem_classes="right_content")
148
  with antd.Tabs.Item(key="render"):
149
  sandbox = gr.HTML(elem_classes="html_content")
150
  # sandbox = pro.FrontendCodeSandbox(elem_style={
 
94
  """)
95
  # input = antd.InputTextarea(
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):
103
  with antd.Card(hoverable=True, as_item="card") as demoCard:
104
  antd.CardMeta()
105
  demoCard.click(demo_card_click, outputs=[input])
106
 
107
+ antd.Divider("setting")
108
 
109
  with antd.Flex(gap="small", wrap=True):
110
  settingPromptBtn = antd.Button(
111
+ "⚙️ set system Prompt", type="default")
112
+ codeBtn = antd.Button("🧑‍💻 view code", type="default")
113
+ historyBtn = antd.Button("📜 history", type="default")
114
 
115
+ with antd.Modal(open=False, title="set system Prompt", width="800px") as system_prompt_modal:
116
  systemPromptInput = antd.InputTextarea(
117
  SystemPrompt, auto_size=True)
118
 
 
123
  system_prompt_modal.cancel(lambda: gr.update(
124
  open=False), outputs=[system_prompt_modal])
125
 
126
+ with antd.Drawer(open=False, title="code", placement="left", width="750px") as code_drawer:
127
  code_output = legacy.Markdown()
128
 
129
  codeBtn.click(lambda: gr.update(open=True),
 
131
  code_drawer.close(lambda: gr.update(
132
  open=False), inputs=[], outputs=[code_drawer])
133
 
134
+ with antd.Drawer(open=False, title="history", placement="left", width="900px") as history_drawer:
135
  history_output = legacy.Chatbot(show_label=False, flushing=False, height=960, elem_classes="history_chatbot")
136
 
137
  historyBtn.click(history_render, inputs=[history], outputs=[history_drawer, history_output])
 
142
  gr.HTML('<div class="render_header"><span class="header_btn"></span><span class="header_btn"></span><span class="header_btn"></span></div>')
143
  with antd.Tabs(active_key="empty", render_tab_bar="() => null") as state_tab:
144
  with antd.Tabs.Item(key="empty"):
145
+ empty = antd.Empty(description="empty input", elem_classes="right_content")
146
  with antd.Tabs.Item(key="loading"):
147
+ loading = antd.Spin(True, tip="coding...", size="large", elem_classes="right_content")
148
  with antd.Tabs.Item(key="render"):
149
  sandbox = gr.HTML(elem_classes="html_content")
150
  # sandbox = pro.FrontendCodeSandbox(elem_style={