rodrisouza commited on
Commit
6ad97e4
·
verified ·
1 Parent(s): 789fbfb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -96,10 +96,9 @@ def interact(user_input, history, interaction_count):
96
  interaction_count += 1
97
 
98
  if interaction_count >= MAX_INTERACTIONS:
99
- response = "Thank you for your questions. Our session is now over. Goodbye!"
100
- history.append({"role": "assistant", "content": response})
101
- else:
102
- history.append({"role": "assistant", "content": response})
103
 
104
  formatted_history = [(entry["content"], None) if entry["role"] == "user" else (None, entry["content"]) for entry in history if entry["role"] in ["user", "assistant"]]
105
 
@@ -242,4 +241,4 @@ with gr.Blocks() as demo:
242
  send_message_button.click(fn=interact, inputs=[chatbot_input, chat_history_json, interaction_count], outputs=[chatbot_input, chatbot_output, chat_history_json, interaction_count])
243
  save_button.click(fn=save_comment_score, inputs=[chatbot_output, score_input, comment_input, story_dropdown, user_dropdown, system_prompt_dropdown], outputs=[data_table, comment_input])
244
 
245
- demo.launch()
 
96
  interaction_count += 1
97
 
98
  if interaction_count >= MAX_INTERACTIONS:
99
+ response = response.strip() + "\n\nThank you for your questions. Our session is now over. Goodbye!"
100
+
101
+ history.append({"role": "assistant", "content": response})
 
102
 
103
  formatted_history = [(entry["content"], None) if entry["role"] == "user" else (None, entry["content"]) for entry in history if entry["role"] in ["user", "assistant"]]
104
 
 
241
  send_message_button.click(fn=interact, inputs=[chatbot_input, chat_history_json, interaction_count], outputs=[chatbot_input, chatbot_output, chat_history_json, interaction_count])
242
  save_button.click(fn=save_comment_score, inputs=[chatbot_output, score_input, comment_input, story_dropdown, user_dropdown, system_prompt_dropdown], outputs=[data_table, comment_input])
243
 
244
+ demo.launch()