add a small feature in web_demo

Added the function of pressing the enter key to generate an answer in web_demo
pull/9/head
Bernard Tan 2023-03-14 16:48:47 +08:00 committed by GitHub
parent 4f4d3e5df0
commit 4da3176801
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -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)