Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Style stop button
Browse files- app.py +9 -3
- e2bqwen.py +3 -2
app.py
CHANGED
@@ -657,7 +657,7 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js) as demo:
|
|
657 |
label="Header"
|
658 |
)
|
659 |
|
660 |
-
stop_btn = gr.Button("Stop the agent!")
|
661 |
|
662 |
chatbot_display = gr.Chatbot(
|
663 |
elem_id="chatbot",
|
@@ -695,6 +695,9 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js) as demo:
|
|
695 |
def set_interactive(request: gr.Request):
|
696 |
return update_html(True, request)
|
697 |
|
|
|
|
|
|
|
698 |
is_interactive = gr.Checkbox(value=True, visible=False)
|
699 |
|
700 |
# Chain the events
|
@@ -708,14 +711,17 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js) as demo:
|
|
708 |
outputs=[chatbot_display]
|
709 |
).then(
|
710 |
fn=set_interactive,
|
711 |
-
inputs=[],
|
712 |
outputs=[sandbox_html]
|
|
|
|
|
|
|
713 |
)
|
714 |
|
715 |
def interrupt_agent(session_state):
|
716 |
session_state["agent"].interrupt()
|
|
|
717 |
|
718 |
-
stop_btn.click(fn=interrupt_agent, inputs=[session_state],
|
719 |
|
720 |
def set_logs_source(session_state):
|
721 |
session_state["replay_log"] = "udupp2fyavq_1743170323"
|
|
|
657 |
label="Header"
|
658 |
)
|
659 |
|
660 |
+
stop_btn = gr.Button("Stop the agent!", variant="stop")
|
661 |
|
662 |
chatbot_display = gr.Chatbot(
|
663 |
elem_id="chatbot",
|
|
|
695 |
def set_interactive(request: gr.Request):
|
696 |
return update_html(True, request)
|
697 |
|
698 |
+
def reactivate_stop_btn():
|
699 |
+
return gr.Button("Stop the agent!", variant="stop")
|
700 |
+
|
701 |
is_interactive = gr.Checkbox(value=True, visible=False)
|
702 |
|
703 |
# Chain the events
|
|
|
711 |
outputs=[chatbot_display]
|
712 |
).then(
|
713 |
fn=set_interactive,
|
|
|
714 |
outputs=[sandbox_html]
|
715 |
+
).then(
|
716 |
+
fn=reactivate_stop_btn,
|
717 |
+
outputs=[stop_btn]
|
718 |
)
|
719 |
|
720 |
def interrupt_agent(session_state):
|
721 |
session_state["agent"].interrupt()
|
722 |
+
return gr.Button("Stopping agent... (could take time)", variant="secondary")
|
723 |
|
724 |
+
stop_btn.click(fn=interrupt_agent, inputs=[session_state], outputs=[stop_btn])
|
725 |
|
726 |
def set_logs_source(session_state):
|
727 |
session_state["replay_log"] = "udupp2fyavq_1743170323"
|
e2bqwen.py
CHANGED
@@ -47,7 +47,7 @@ On top of performing computations in the Python code snippets that you create, y
|
|
47 |
Returns an output of type: {{tool.output_type}}
|
48 |
{%- endfor %}
|
49 |
|
50 |
-
The desktop has a resolution of <<resolution_x>>x<<resolution_y
|
51 |
If you clicked somewhere in the previous action, a red crosshair will appear at the exact location of the previous click.
|
52 |
The image might have change since then but the cross stays at the previous click. If your click seems to have changed nothing, check that this location is exactly where you intended to click. Otherwise correct the click coordinates.
|
53 |
</tools>
|
@@ -146,6 +146,7 @@ Use click to move through menus on the desktop and scroll for web and specific a
|
|
146 |
Always analyze the latest screenshot carefully before performing actions. Make sure to:
|
147 |
To navigate the desktop you should open menus and click. Menus usually expand with more options, the tiny triangle next to some text in a menu means that menu expands. For example in Office in the Applications menu expands showing presentation or writing applications.
|
148 |
Always analyze the latest screenshot carefully before performing actions.
|
|
|
149 |
</general_guidelines>
|
150 |
"""
|
151 |
|
@@ -377,7 +378,7 @@ class E2BVisionAgent(CodeAgent):
|
|
377 |
current_step = memory_step.step_number
|
378 |
|
379 |
time.sleep(2.0) # Let things happen on the desktop
|
380 |
-
screenshot_bytes = self.desktop.screenshot()
|
381 |
image = Image.open(BytesIO(screenshot_bytes))
|
382 |
|
383 |
if getattr(self, "click_coordinates", None):
|
|
|
47 |
Returns an output of type: {{tool.output_type}}
|
48 |
{%- endfor %}
|
49 |
|
50 |
+
The desktop has a resolution of <<resolution_x>>x<<resolution_y>> pixels, take it into account to decide clicking coordinates.
|
51 |
If you clicked somewhere in the previous action, a red crosshair will appear at the exact location of the previous click.
|
52 |
The image might have change since then but the cross stays at the previous click. If your click seems to have changed nothing, check that this location is exactly where you intended to click. Otherwise correct the click coordinates.
|
53 |
</tools>
|
|
|
146 |
Always analyze the latest screenshot carefully before performing actions. Make sure to:
|
147 |
To navigate the desktop you should open menus and click. Menus usually expand with more options, the tiny triangle next to some text in a menu means that menu expands. For example in Office in the Applications menu expands showing presentation or writing applications.
|
148 |
Always analyze the latest screenshot carefully before performing actions.
|
149 |
+
The desktop has a resolution of <<resolution_x>>x<<resolution_y>> pixels.
|
150 |
</general_guidelines>
|
151 |
"""
|
152 |
|
|
|
378 |
current_step = memory_step.step_number
|
379 |
|
380 |
time.sleep(2.0) # Let things happen on the desktop
|
381 |
+
screenshot_bytes = self.desktop.screenshot(format="bytes")
|
382 |
image = Image.open(BytesIO(screenshot_bytes))
|
383 |
|
384 |
if getattr(self, "click_coordinates", None):
|