lilyhof commited on
Commit
5a578a3
·
1 Parent(s): f1c7f41

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -57,10 +57,16 @@ with gr.Blocks() as demo:
57
 
58
  # First add user's message to the conversation history
59
  # Then get reply from the tutor and add that to the conversation history
60
- user_chat_submit.click(
61
- fn = add_user_message, inputs = [user_chat_input, study_tutor], outputs = [user_chat_input, chatbot, study_tutor], queue=False
 
 
 
62
  ).then(
63
- fn = get_tutor_reply, inputs = [study_tutor], outputs = [user_chat_input, chatbot, study_tutor], queue=True
 
 
 
64
  )
65
 
66
  # Testing the chat history storage, can be deleted at deployment
 
57
 
58
  # First add user's message to the conversation history
59
  # Then get reply from the tutor and add that to the conversation history
60
+ user_chat_input.onkeydown(
61
+ fn = lambda event: handleKeyPress(event, add_user_message),
62
+ inputs = [user_chat_input, study_tutor],
63
+ outputs = [user_chat_input, chatbot, study_tutor],
64
+ queue=False
65
  ).then(
66
+ fn = get_tutor_reply,
67
+ inputs = [study_tutor],
68
+ outputs = [user_chat_input, chatbot, study_tutor],
69
+ queue=True
70
  )
71
 
72
  # Testing the chat history storage, can be deleted at deployment