From 2f16d0afca0abf9cacf1a0c326db642b3b0ea75e Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Sat, 8 Apr 2023 17:32:36 -0300 Subject: [PATCH] Remove redundant events --- server.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/server.py b/server.py index c5db7b10..5d004101 100644 --- a/server.py +++ b/server.py @@ -397,20 +397,15 @@ def create_interface(): clear_arr = [shared.gradio[k] for k in ['Clear history-confirm', 'Clear history', 'Clear history-cancel']] reload_inputs = [shared.gradio[k] for k in ['name1', 'name2', 'Chat mode']] - def set_chat_input(textbox): - return textbox, "" - gen_events.append(shared.gradio['Generate'].click( - set_chat_input, shared.gradio['textbox'], [shared.gradio['Chat input'], shared.gradio['textbox']], show_progress=False).then( + lambda x : (x, ''), shared.gradio['textbox'], [shared.gradio['Chat input'], shared.gradio['textbox']], show_progress=False).then( chat.cai_chatbot_wrapper, shared.input_params, shared.gradio['display'], show_progress=shared.args.no_stream).then( - lambda x: '', shared.gradio['textbox'], shared.gradio['textbox'], show_progress=False).then( lambda: chat.save_history(timestamp=False), [], [], show_progress=False) ) gen_events.append(shared.gradio['textbox'].submit( - set_chat_input, shared.gradio['textbox'], [shared.gradio['Chat input'], shared.gradio['textbox']], show_progress=False).then( + lambda x : (x, ''), shared.gradio['textbox'], [shared.gradio['Chat input'], shared.gradio['textbox']], show_progress=False).then( chat.cai_chatbot_wrapper, shared.input_params, shared.gradio['display'], show_progress=shared.args.no_stream).then( - lambda x: '', shared.gradio['textbox'], shared.gradio['textbox'], show_progress=False).then( lambda: chat.save_history(timestamp=False), [], [], show_progress=False) )