peterkros commited on
Commit
58f0d86
·
verified ·
1 Parent(s): 2194f61

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -61,10 +61,10 @@ def generate_response(selected_question):
61
  chat_history.append(new_response)
62
  follow_up_questions = []
63
 
64
- return chat_history, follow_up_questions
65
 
66
  def update_examples(follow_up_questions):
67
- return gr.Examples.update(examples=[[q] for q in follow_up_questions])
68
 
69
  with gr.Blocks() as demo:
70
  gr.Markdown(
@@ -86,8 +86,6 @@ with gr.Blocks() as demo:
86
  txt = gr.Textbox(scale=4, show_label=False, placeholder="Select Question", container=False, interactive=False) # Adjust based on need
87
  btn = gr.Button("Submit")
88
 
89
- btn.click(fn=generate_response, inputs=[txt], outputs=[chatbot, 'examples'])
90
-
91
  examples_component = gr.Examples(
92
  examples=[
93
  ["What are the basic requirements to become an airforce pilot?"],
@@ -99,7 +97,9 @@ with gr.Blocks() as demo:
99
  label="Select Question"
100
  )
101
 
 
 
102
  chatbot.like(print_like_dislike, None, None)
103
 
104
  if __name__ == "__main__":
105
- demo.launch()
 
61
  chat_history.append(new_response)
62
  follow_up_questions = []
63
 
64
+ return chat_history, [[q] for q in follow_up_questions]
65
 
66
  def update_examples(follow_up_questions):
67
+ return gr.Examples.update(examples=follow_up_questions)
68
 
69
  with gr.Blocks() as demo:
70
  gr.Markdown(
 
86
  txt = gr.Textbox(scale=4, show_label=False, placeholder="Select Question", container=False, interactive=False) # Adjust based on need
87
  btn = gr.Button("Submit")
88
 
 
 
89
  examples_component = gr.Examples(
90
  examples=[
91
  ["What are the basic requirements to become an airforce pilot?"],
 
97
  label="Select Question"
98
  )
99
 
100
+ btn.click(fn=generate_response, inputs=[txt], outputs=[chatbot, examples_component])
101
+
102
  chatbot.like(print_like_dislike, None, None)
103
 
104
  if __name__ == "__main__":
105
+ demo.launch()