youngtsai commited on
Commit
f5c871b
1 Parent(s): 1b79c0f

btn_create_question.click(get_questions, inputs = [df_string_output], outputs = [btn_1, btn_2, btn_3])

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -463,6 +463,13 @@ def generate_questions(df_string):
463
 
464
  return questions
465
 
 
 
 
 
 
 
 
466
  def send_question(question, df_string_output, chat_history):
467
  # 当问题按钮被点击时调用此函数
468
  return respond(question, df_string_output, chat_history)
@@ -590,7 +597,7 @@ with gr.Blocks() as demo:
590
  btn_2.click(respond, inputs=[btn_2, df_string_output, chatbot], outputs=[msg, chatbot])
591
  btn_3.click(respond, inputs=[btn_3, df_string_output, chatbot], outputs=[msg, chatbot])
592
 
593
- btn_create_question.click(generate_questions, inputs = [df_string_output], outputs = [btn_1, btn_2, btn_3])
594
 
595
  # file_upload.change(process_file, inputs=file_upload, outputs=df_string_output)
596
  file_upload.change(process_file, inputs=file_upload, outputs=[btn_1, btn_2, btn_3, df_summarise, df_string_output])
 
463
 
464
  return questions
465
 
466
+ def get_questions(df_string):
467
+ questions = generate_questions(df_string)
468
+ q1 = questions[0] if len(questions) > 0 else ""
469
+ q2 = questions[1] if len(questions) > 1 else ""
470
+ q3 = questions[2] if len(questions) > 2 else ""
471
+ return q1, q2, q3
472
+
473
  def send_question(question, df_string_output, chat_history):
474
  # 当问题按钮被点击时调用此函数
475
  return respond(question, df_string_output, chat_history)
 
597
  btn_2.click(respond, inputs=[btn_2, df_string_output, chatbot], outputs=[msg, chatbot])
598
  btn_3.click(respond, inputs=[btn_3, df_string_output, chatbot], outputs=[msg, chatbot])
599
 
600
+ btn_create_question.click(get_questions, inputs = [df_string_output], outputs = [btn_1, btn_2, btn_3])
601
 
602
  # file_upload.change(process_file, inputs=file_upload, outputs=df_string_output)
603
  file_upload.change(process_file, inputs=file_upload, outputs=[btn_1, btn_2, btn_3, df_summarise, df_string_output])