AllenYkl commited on
Commit
3d181a8
1 Parent(s): c8a63e8

Update bin_public/app/Chatbot.py

Browse files
Files changed (1) hide show
  1. bin_public/app/Chatbot.py +33 -0
bin_public/app/Chatbot.py CHANGED
@@ -172,6 +172,10 @@ with gr.Blocks(css=customCSS) as demo:
172
  with gr.Row():
173
  interviewer = gr.Button("面试官")
174
  migraine = gr.Button("医生问诊")
 
 
 
 
175
  index_pinecone = gr.Textbox(placeholder=f"Index fetched", visible=True)
176
 
177
  with gr.Tab(label="Davinci-003"):
@@ -356,6 +360,35 @@ with gr.Blocks(css=customCSS) as demo:
356
  [chatbot, history, status_display, token_count], show_progress=True
357
  ).then(reset_textbox, [], [user_input])
358
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
359
  # Davinci
360
  davinci_user_input.submit(predict_davinci,
361
  [
 
172
  with gr.Row():
173
  interviewer = gr.Button("面试官")
174
  migraine = gr.Button("医生问诊")
175
+ pre_defined_q = gr.Dropdown(label="选择预设问题",
176
+ choices=qs,
177
+ multiselect=False,
178
+ value=qs[0])
179
  index_pinecone = gr.Textbox(placeholder=f"Index fetched", visible=True)
180
 
181
  with gr.Tab(label="Davinci-003"):
 
360
  [chatbot, history, status_display, token_count], show_progress=True
361
  ).then(reset_textbox, [], [user_input])
362
 
363
+ pre_defined_q.change(get_pre_defined_q,
364
+ [pre_defined_q],
365
+ [user_input]).then(context_construction,[
366
+ keyTxt,
367
+ user_input,
368
+ model_select_dropdown,
369
+ pinecone_api_key,
370
+ pinecone_api_env,
371
+ temperature,
372
+ pinecone_index_name],
373
+ [systemPromptTxt, status_display]
374
+ ).then(
375
+ predict, [
376
+ keyTxt,
377
+ invite_code,
378
+ systemPromptTxt,
379
+ history,
380
+ user_input,
381
+ chatbot,
382
+ token_count,
383
+ top_p,
384
+ temperature,
385
+ use_streaming_checkbox,
386
+ model_select_dropdown,
387
+ use_websearch_checkbox,
388
+ index_files],
389
+ [chatbot, history, status_display, token_count], show_progress=True
390
+ ).then(reset_textbox, [], [user_input])
391
+
392
  # Davinci
393
  davinci_user_input.submit(predict_davinci,
394
  [