AllenYkl commited on
Commit
25ec502
·
1 Parent(s): d4987a9

Update bin_public/app/Chatbot.py

Browse files
Files changed (1) hide show
  1. bin_public/app/Chatbot.py +72 -0
bin_public/app/Chatbot.py CHANGED
@@ -153,6 +153,31 @@ with gr.Blocks(css=customCSS) as demo:
153
  with gr.Column():
154
  downloadFile = gr.File(interactive=True)
155
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  gr.HTML("""
157
  <div style="text-align: center; margin-top: 20px; margin-bottom: 20px;">
158
  """)
@@ -266,6 +291,53 @@ with gr.Blocks(css=customCSS) as demo:
266
  [systemPromptTxt],
267
  show_progress=True)
268
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269
  logging.info("\n访问 http://localhost:7860 查看界面")
270
  # 默认开启本地服务器,默认可以直接从IP访问,默认不创建公开分享链接
271
  demo.title = "ChatGPT-长江商学院 🚀"
 
153
  with gr.Column():
154
  downloadFile = gr.File(interactive=True)
155
 
156
+ with gr.Tab(label="学术功能"):
157
+ with gr.Row():
158
+ aep = gr.Button("英语学术润色")
159
+ acp = gr.Button("中文学术润色")
160
+ sge = gr.Button("查找英文语法错误")
161
+ ac2e = gr.Button("学术中译英")
162
+ c2e = gr.Button("中译英")
163
+ e2c = gr.Button("英译中")
164
+
165
+ with gr.Tab(label="角色"):
166
+ with gr.Row():
167
+ interviewer = gr.Button("面试官")
168
+
169
+ with gr.Tab(label="Davinci-003"):
170
+ with gr.Column():
171
+ with gr.Row():
172
+ with gr.Column():
173
+ davinci_user_input = gr.Textbox(show_label=False, placeholder="在这里输入").style(
174
+ container=False)
175
+ temperature_davinci = gr.Slider(minimum=-0, maximum=1.0, value=0.7,
176
+ step=0.1, interactive=True, label="Temperature", )
177
+ davinci_submitBtn = gr.Button("🚀", variant="primary")
178
+ davinci_output = gr.Textbox(show_label=False, placeholder="output").style(
179
+ container=False)
180
+
181
  gr.HTML("""
182
  <div style="text-align: center; margin-top: 20px; margin-bottom: 20px;">
183
  """)
 
291
  [systemPromptTxt],
292
  show_progress=True)
293
 
294
+ # 功能
295
+ function_button_list = [aep, acp, sge, ac2e, c2e, e2c]
296
+ for i in function_button_list:
297
+ name = gr.Dropdown(choices=list(function.keys()), value=i.value, visible=False)
298
+ i.click(get_function_content,
299
+ [function_template, name],
300
+ [systemPromptTxt],
301
+ show_progress=True)
302
+
303
+ # 角色
304
+ interviewer.click(predict, [
305
+ keyTxt,
306
+ invite_code,
307
+ interviewer_prompt,
308
+ history,
309
+ user_input,
310
+ chatbot,
311
+ token_count,
312
+ top_p,
313
+ temperature,
314
+ use_streaming_checkbox,
315
+ model_select_dropdown,
316
+ use_websearch_checkbox,
317
+ index_files],
318
+ [chatbot, history, status_display, token_count], show_progress=True)
319
+
320
+ interviewer.click(get_character_content,
321
+ [interviewer_prompt],
322
+ [systemPromptTxt])
323
+
324
+ # Davinci
325
+ davinci_user_input.submit(predict_davinci,
326
+ [
327
+ keyTxt,
328
+ davinci_user_input,
329
+ temperature,
330
+ ],
331
+ [davinci_output], show_progress=True)
332
+
333
+ davinci_submitBtn.click(predict_davinci,
334
+ [
335
+ keyTxt,
336
+ davinci_user_input,
337
+ temperature_davinci,
338
+ ],
339
+ [davinci_output], show_progress=True)
340
+
341
  logging.info("\n访问 http://localhost:7860 查看界面")
342
  # 默认开启本地服务器,默认可以直接从IP访问,默认不创建公开分享链接
343
  demo.title = "ChatGPT-长江商学院 🚀"