Skip to content

Commit e91ab05

Browse files
overlay_utils can return array if needed.
1 parent 356b0d7 commit e91ab05

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/agentlab/agents/agent_utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from agentlab.analyze import overlay_utils
77
from agentlab.llm.llm_utils import img_to_base_64
8+
import numpy as np
89

910

1011
def draw_mouse_pointer(image: Image.Image, x: int, y: int) -> Image.Image:
@@ -135,7 +136,7 @@ def zoom_webpage(page: Page, zoom_factor: float = 1.5):
135136
return page
136137

137138

138-
def overlay_action(obs, action):
139+
def overlay_action(obs, action, return_array=False):
139140
"""Overlays actions on screenshot in-place"""
140141
act_img = copy.deepcopy(obs["screenshot"])
141142
act_img = Image.fromarray(act_img)
@@ -153,4 +154,7 @@ def overlay_action(obs, action):
153154
pass
154155

155156
overlay_utils.annotate_action(act_img, action, properties=new_obs_properties)
156-
return img_to_base_64(act_img)
157+
if return_array:
158+
return np.array(act_img)
159+
else:
160+
return img_to_base_64(act_img)

0 commit comments

Comments
 (0)