MCPcopy Create free account
hub / github.com/OpenBMB/AgentCPM-GUI / extract_coords

Function extract_coords

eval/run_predict_ui_tars.py:298–307  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

296
297 # auxiliary function to extract coordinates
298 def extract_coords(s):
299 # directly find and extract the coordinates in the parentheses
300 first_bracket = s.find("(")
301 start = s.find("(", first_bracket + 1)
302 end = s.find(")")
303 if start != -1 and end != -1:
304 coords_str = s[start+1:end].strip() # extract the content in (x,y)
305 x, y = coords_str.split(",")
306 return [int(x), int(y)]
307 raise ValueError(f"Cannot find coordinates in the string: {s}")
308
309 if "click(" in action_str:
310 result["POINT"] = extract_coords(action_str)

Callers 1

uitars2minicpmFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected