peterkros commited on
Commit
b10ef36
·
verified ·
1 Parent(s): 777ebf7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -162,9 +162,11 @@ css = """
162
  # Initialize the chat history and suggested questionsw
163
  chat_history, follow_up_questions, initial_token_info = initialize_chat()
164
 
165
- def fill_textbox(examples_df, row_index, txt):
166
- example_question = examples_df.iloc[row_index]['Example Questions']
167
- return example_question
 
 
168
 
169
  # Initial example questions from the initialization
170
  formatted_questions = [q.strip() for q in follow_up_questions.split('\n')[:3]]
@@ -216,7 +218,7 @@ with gr.Blocks(css=css) as demo:
216
  )
217
  examples_component.select(
218
  fn=fill_textbox,
219
- inputs=[examples_state, gr.Index(), txt],
220
  outputs=[txt]
221
  )
222
 
 
162
  # Initialize the chat history and suggested questionsw
163
  chat_history, follow_up_questions, initial_token_info = initialize_chat()
164
 
165
+ def fill_textbox(examples_df, selected_row, txt):
166
+ if selected_row is not None and not examples_df.empty:
167
+ example_question = examples_df.iloc[selected_row]['Example Questions']
168
+ return example_question
169
+ return ""
170
 
171
  # Initial example questions from the initialization
172
  formatted_questions = [q.strip() for q in follow_up_questions.split('\n')[:3]]
 
218
  )
219
  examples_component.select(
220
  fn=fill_textbox,
221
+ inputs=[examples_state, gr.Number(), txt],
222
  outputs=[txt]
223
  )
224