peterkros commited on
Commit
4d07f34
·
verified ·
1 Parent(s): 58f0d86

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -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, [[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,7 +86,11 @@ 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
- examples_component = gr.Examples(
 
 
 
 
90
  examples=[
91
  ["What are the basic requirements to become an airforce pilot?"],
92
  ["How long does it take to train as an airforce pilot?"],
@@ -97,8 +101,6 @@ with gr.Blocks() as demo:
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__":
 
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.Dataframe.update(value=[[q] for q in 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_df = gr.Dataframe(headers=["Suggested Questions"], datatype="str")
90
+
91
+ btn.click(fn=generate_response, inputs=[txt], outputs=[chatbot, examples_df])
92
+
93
+ examples = gr.Examples(
94
  examples=[
95
  ["What are the basic requirements to become an airforce pilot?"],
96
  ["How long does it take to train as an airforce pilot?"],
 
101
  label="Select Question"
102
  )
103
 
 
 
104
  chatbot.like(print_like_dislike, None, None)
105
 
106
  if __name__ == "__main__":