File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -139,5 +139,17 @@ def overlay_action(obs, action):
139139 """Overlays actions on screenshot in-place"""
140140 act_img = copy .deepcopy (obs ["screenshot" ])
141141 act_img = Image .fromarray (act_img )
142- overlay_utils .annotate_action (act_img , action , properties = obs ["extra_element_properties" ])
142+
143+ new_obs_properties = copy .deepcopy (obs ["extra_element_properties" ])
144+ import os
145+ if os .getenv ("AGENTLAB_USE_RETINA" ):
146+ # HACK: divide everything by 2 in the obs
147+ # TODO: make this more robust by changing login in annotate_action directly (or maybe in the obs section?)
148+ for key , value in new_obs_properties .items ():
149+ try :
150+ new_obs_properties [key ]["bbox" ] = [elem / 2 for elem in value ["bbox" ]]
151+ except :
152+ pass
153+
154+ overlay_utils .annotate_action (act_img , action , properties = new_obs_properties )
143155 return img_to_base_64 (act_img )
You can’t perform that action at this time.
0 commit comments