Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -113,9 +113,8 @@ def process_response(prompt, chat_history, token_count, examples_state):
|
|
113 |
question1, question2, question3 = new_follow_up_questions_formatted
|
114 |
|
115 |
# Update examples state with the new follow-up questions
|
116 |
-
|
117 |
-
|
118 |
-
examples_state = pd.DataFrame({'Example Questions': new_follow_up_questions_formatted})
|
119 |
|
120 |
follow_up_questions_md = "\n".join(new_follow_up_questions_formatted)
|
121 |
|
@@ -163,11 +162,6 @@ css = """
|
|
163 |
# Initialize the chat history and suggested questionsw
|
164 |
chat_history, follow_up_questions, initial_token_info = initialize_chat()
|
165 |
|
166 |
-
def fill_textbox(examples_df, selected_row, txt):
|
167 |
-
if selected_row is not None and not examples_df.empty:
|
168 |
-
example_question = examples_df.iloc[selected_row]['Example Questions']
|
169 |
-
return example_question
|
170 |
-
return ""
|
171 |
|
172 |
# Initial example questions from the initialization
|
173 |
formatted_questions = [q.strip() for q in follow_up_questions.split('\n')[:3]]
|
@@ -210,18 +204,12 @@ with gr.Blocks(css=css) as demo:
|
|
210 |
outputs=[chatbot, token_info, follow_up_questions_md, examples_state]
|
211 |
|
212 |
)
|
213 |
-
examples_component = gr.
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
)
|
220 |
-
examples_component.select(
|
221 |
-
fn=fill_textbox,
|
222 |
-
inputs=[examples_state, gr.Number(), txt],
|
223 |
-
outputs=[txt]
|
224 |
-
)
|
225 |
|
226 |
chatbot.like(print_like_dislike, None, None)
|
227 |
|
|
|
113 |
question1, question2, question3 = new_follow_up_questions_formatted
|
114 |
|
115 |
# Update examples state with the new follow-up questions
|
116 |
+
examples_state = [[question1], [question2], [question3]]
|
117 |
+
|
|
|
118 |
|
119 |
follow_up_questions_md = "\n".join(new_follow_up_questions_formatted)
|
120 |
|
|
|
162 |
# Initialize the chat history and suggested questionsw
|
163 |
chat_history, follow_up_questions, initial_token_info = initialize_chat()
|
164 |
|
|
|
|
|
|
|
|
|
|
|
165 |
|
166 |
# Initial example questions from the initialization
|
167 |
formatted_questions = [q.strip() for q in follow_up_questions.split('\n')[:3]]
|
|
|
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 |
|
214 |
chatbot.like(print_like_dislike, None, None)
|
215 |
|