Update app.py
This commit is contained in:
parent
f758461184
commit
2736189eb4
27
app.py
27
app.py
|
@ -107,6 +107,8 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
||||||
).style(container=False)
|
).style(container=False)
|
||||||
with gr.Column(min_width=70, scale=1):
|
with gr.Column(min_width=70, scale=1):
|
||||||
submitBtn = gr.Button("Send")
|
submitBtn = gr.Button("Send")
|
||||||
|
with gr.Column(min_width=70, scale=1):
|
||||||
|
cancelBtn = gr.Button("Stop")
|
||||||
|
|
||||||
|
|
||||||
with gr.Row(scale=1):
|
with gr.Row(scale=1):
|
||||||
|
@ -191,9 +193,9 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
||||||
fn=transfer_input, inputs=[user_input], outputs=[user_question, user_input, submitBtn], show_progress=True
|
fn=transfer_input, inputs=[user_input], outputs=[user_question, user_input, submitBtn], show_progress=True
|
||||||
)
|
)
|
||||||
|
|
||||||
user_input.submit(**transfer_input_args).then(**predict_args)
|
predict_event1 = user_input.submit(**transfer_input_args).then(**predict_args)
|
||||||
|
|
||||||
submitBtn.click(**transfer_input_args).then(**predict_args)
|
predict_event2 = submitBtn.click(**transfer_input_args).then(**predict_args)
|
||||||
|
|
||||||
emptyBtn.click(
|
emptyBtn.click(
|
||||||
reset_state,
|
reset_state,
|
||||||
|
@ -202,7 +204,7 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
||||||
)
|
)
|
||||||
emptyBtn.click(**reset_args)
|
emptyBtn.click(**reset_args)
|
||||||
|
|
||||||
retryBtn.click(**retry_args)
|
predict_event3 = retryBtn.click(**retry_args)
|
||||||
|
|
||||||
delLastBtn.click(
|
delLastBtn.click(
|
||||||
delete_last_conversation,
|
delete_last_conversation,
|
||||||
|
@ -210,11 +212,18 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
||||||
[chatbot, history, status_display],
|
[chatbot, history, status_display],
|
||||||
show_progress=True,
|
show_progress=True,
|
||||||
)
|
)
|
||||||
|
cancelBtn.click(
|
||||||
|
cancel_outputing, [], [status_display],
|
||||||
|
cancels=[
|
||||||
|
predict_event1,predict_event2,predict_event3
|
||||||
|
]
|
||||||
|
)
|
||||||
demo.title = "Baize"
|
demo.title = "Baize"
|
||||||
|
|
||||||
if __name__ == "__main__":
|
demo.queue(
|
||||||
reload_javascript()
|
concurrency_count=1,
|
||||||
demo.queue(concurrency_count=1).launch(
|
max_size=100,
|
||||||
share=False, favicon_path="./assets/favicon.ico", inbrowser=True
|
).launch(
|
||||||
)
|
max_threads=5,
|
||||||
|
server_name="0.0.0.0",
|
||||||
|
)
|
Loading…
Reference in New Issue