peterkros commited on
Commit
0be94a8
·
verified ·
1 Parent(s): e750bad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -112,12 +112,13 @@ def process_response(prompt, chat_history, token_count, examples_state):
112
  question1, question2, question3 = new_follow_up_questions_formatted
113
 
114
  # Update examples state with the new follow-up questions
115
- examples_state = [[question1], [question2], [question3]]
 
 
116
 
117
  follow_up_questions_md = "\n".join(new_follow_up_questions_formatted)
118
 
119
 
120
-
121
  return chat_history, token_info, follow_up_questions_md, examples_state
122
 
123
  # CSS for the phone layout and background
@@ -204,11 +205,12 @@ with gr.Blocks(css=css) as demo:
204
  outputs=[chatbot, token_info, follow_up_questions_md, examples_state]
205
 
206
  )
207
- examples_component = gr.Examples(
208
- examples=examples_state.value,
209
- inputs=[txt],
210
- label="Example Questions"
211
- )
 
212
 
213
  chatbot.like(print_like_dislike, None, None)
214
 
 
112
  question1, question2, question3 = new_follow_up_questions_formatted
113
 
114
  # Update examples state with the new follow-up questions
115
+ # examples_state = [[question1], [question2], [question3]]
116
+ # Create a DataFrame for the new examples
117
+ examples_state = pd.DataFrame({'Example Questions': new_follow_up_questions_formatted})
118
 
119
  follow_up_questions_md = "\n".join(new_follow_up_questions_formatted)
120
 
121
 
 
122
  return chat_history, token_info, follow_up_questions_md, examples_state
123
 
124
  # CSS for the phone layout and background
 
205
  outputs=[chatbot, token_info, follow_up_questions_md, examples_state]
206
 
207
  )
208
+ examples_component = gr.Dataframe(
209
+ value=examples_state.value,
210
+ headers=['Example Questions'],
211
+ datatype='str',
212
+ elem_id="example-container"
213
+ )
214
 
215
  chatbot.like(print_like_dislike, None, None)
216