Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Add stop button
Browse files
app.py
CHANGED
@@ -568,7 +568,7 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js) as demo:
|
|
568 |
elem_classes="primary-color-label"
|
569 |
)
|
570 |
|
571 |
-
|
572 |
|
573 |
gr.Examples(
|
574 |
examples=[
|
@@ -646,6 +646,8 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js) as demo:
|
|
646 |
label="Header"
|
647 |
)
|
648 |
|
|
|
|
|
649 |
chatbot_display = gr.Chatbot(
|
650 |
label="Agent's execution logs",
|
651 |
type="messages",
|
@@ -684,12 +686,11 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js) as demo:
|
|
684 |
is_interactive = gr.Checkbox(value=True, visible=False)
|
685 |
|
686 |
# Chain the events
|
687 |
-
|
688 |
fn=clear_and_set_view_only,
|
689 |
inputs=[task_input],
|
690 |
outputs=[sandbox_html]
|
691 |
-
)
|
692 |
-
view_only_event.then(
|
693 |
agent_ui.interact_with_agent,
|
694 |
inputs=[task_input, stored_messages, session_state, session_hash_state],
|
695 |
outputs=[chatbot_display]
|
@@ -699,6 +700,8 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js) as demo:
|
|
699 |
outputs=[sandbox_html]
|
700 |
)
|
701 |
|
|
|
|
|
702 |
def set_logs_source(session_state):
|
703 |
session_state["replay_log"] = "udupp2fyavq_1743170323"
|
704 |
|
|
|
568 |
elem_classes="primary-color-label"
|
569 |
)
|
570 |
|
571 |
+
run_btn = gr.Button("Let's go!", variant="primary")
|
572 |
|
573 |
gr.Examples(
|
574 |
examples=[
|
|
|
646 |
label="Header"
|
647 |
)
|
648 |
|
649 |
+
stop_btn = gr.Button("Stop the agent!")
|
650 |
+
|
651 |
chatbot_display = gr.Chatbot(
|
652 |
label="Agent's execution logs",
|
653 |
type="messages",
|
|
|
686 |
is_interactive = gr.Checkbox(value=True, visible=False)
|
687 |
|
688 |
# Chain the events
|
689 |
+
run_event = run_btn.click(
|
690 |
fn=clear_and_set_view_only,
|
691 |
inputs=[task_input],
|
692 |
outputs=[sandbox_html]
|
693 |
+
).then(
|
|
|
694 |
agent_ui.interact_with_agent,
|
695 |
inputs=[task_input, stored_messages, session_state, session_hash_state],
|
696 |
outputs=[chatbot_display]
|
|
|
700 |
outputs=[sandbox_html]
|
701 |
)
|
702 |
|
703 |
+
stop_btn.click(fn=None, inputs=None, outputs=None, cancels=[run_event])
|
704 |
+
|
705 |
def set_logs_source(session_state):
|
706 |
session_state["replay_log"] = "udupp2fyavq_1743170323"
|
707 |
|