From 4da3176801f8356e9bc9ffdca711a00c59b2474e Mon Sep 17 00:00:00 2001 From: Bernard Tan <30761156+thkkk@users.noreply.github.com> Date: Tue, 14 Mar 2023 16:48:47 +0800 Subject: [PATCH] add a small feature in web_demo Added the function of pressing the enter key to generate an answer in web_demo --- web_demo.py | 1 + 1 file changed, 1 insertion(+) diff --git a/web_demo.py b/web_demo.py index ff7fc70..9277a92 100644 --- a/web_demo.py +++ b/web_demo.py @@ -34,5 +34,6 @@ with gr.Blocks() as demo: txt = gr.Textbox(show_label=False, placeholder="Enter text and press enter").style(container=False) with gr.Column(scale=1): button = gr.Button("Generate") + txt.submit(predict, [txt, state], [state] + text_boxes) button.click(predict, [txt, state], [state] + text_boxes) demo.queue().launch(share=True)