Spaces:
Runtime error
Runtime error
ffreemt
commited on
Commit
·
402d0dc
1
Parent(s):
9329ff2
Update stop button
Browse files
app.py
CHANGED
|
@@ -363,7 +363,7 @@ with gr.Blocks(
|
|
| 363 |
with gr.Column(scale=1, min_width=50):
|
| 364 |
with gr.Row():
|
| 365 |
submit = gr.Button("Submit", elem_classes="xsmall")
|
| 366 |
-
stop = gr.Button("Stop", visible=
|
| 367 |
clear = gr.Button("Clear History", visible=True)
|
| 368 |
with gr.Row(visible=False):
|
| 369 |
with gr.Accordion("Advanced Options:", open=False):
|
|
@@ -399,7 +399,7 @@ with gr.Blocks(
|
|
| 399 |
elem_classes=["disclaimer"],
|
| 400 |
)
|
| 401 |
|
| 402 |
-
msg.submit(
|
| 403 |
# fn=conversation.user_turn,
|
| 404 |
fn=user,
|
| 405 |
inputs=[msg, chatbot],
|
|
@@ -408,7 +408,7 @@ with gr.Blocks(
|
|
| 408 |
show_progress="full",
|
| 409 |
# api_name=None,
|
| 410 |
).then(bot, chatbot, chatbot, queue=True)
|
| 411 |
-
submit.click(
|
| 412 |
# fn=lambda x, y: ("",) + user(x, y)[1:], # clear msg
|
| 413 |
fn=user1, # clear msg
|
| 414 |
inputs=[msg, chatbot],
|
|
@@ -418,7 +418,13 @@ with gr.Blocks(
|
|
| 418 |
show_progress="full",
|
| 419 |
# api_name=None,
|
| 420 |
).then(bot, chatbot, chatbot, queue=True)
|
| 421 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 422 |
clear.click(lambda: None, None, chatbot, queue=False)
|
| 423 |
|
| 424 |
with gr.Accordion("For Chat/Translation API", open=False, visible=False):
|
|
|
|
| 363 |
with gr.Column(scale=1, min_width=50):
|
| 364 |
with gr.Row():
|
| 365 |
submit = gr.Button("Submit", elem_classes="xsmall")
|
| 366 |
+
stop = gr.Button("Stop", visible=True)
|
| 367 |
clear = gr.Button("Clear History", visible=True)
|
| 368 |
with gr.Row(visible=False):
|
| 369 |
with gr.Accordion("Advanced Options:", open=False):
|
|
|
|
| 399 |
elem_classes=["disclaimer"],
|
| 400 |
)
|
| 401 |
|
| 402 |
+
msg_submit_event = msg.submit(
|
| 403 |
# fn=conversation.user_turn,
|
| 404 |
fn=user,
|
| 405 |
inputs=[msg, chatbot],
|
|
|
|
| 408 |
show_progress="full",
|
| 409 |
# api_name=None,
|
| 410 |
).then(bot, chatbot, chatbot, queue=True)
|
| 411 |
+
submit_click_event = submit.click(
|
| 412 |
# fn=lambda x, y: ("",) + user(x, y)[1:], # clear msg
|
| 413 |
fn=user1, # clear msg
|
| 414 |
inputs=[msg, chatbot],
|
|
|
|
| 418 |
show_progress="full",
|
| 419 |
# api_name=None,
|
| 420 |
).then(bot, chatbot, chatbot, queue=True)
|
| 421 |
+
stop.click(
|
| 422 |
+
fn=None,
|
| 423 |
+
inputs=None,
|
| 424 |
+
outputs=None,
|
| 425 |
+
cancels=[msg_submit_event, submit_click_event],
|
| 426 |
+
queue=False,
|
| 427 |
+
)
|
| 428 |
clear.click(lambda: None, None, chatbot, queue=False)
|
| 429 |
|
| 430 |
with gr.Accordion("For Chat/Translation API", open=False, visible=False):
|