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

Function verify

eval/grounding_eval/code/Aguvis/fun2bbox_eval_aguvis.py:85–106  ·  view source on GitHub ↗

接受模型的字符串输入,判断是否正确

(response, ground_truth)

Source from the content-addressed store, hash-verified

83 return response.strip("\n").replace(" ","")
84
85async def verify(response, ground_truth):
86 """
87 接受模型的字符串输入,判断是否正确
88 """
89 pattern = r'pyautogui\.click\(x=(.*?),y=(.*?)\)'
90 matches = re.findall(pattern, response)
91 # 将输入字符串转换为整数列表
92 if matches:
93 match = matches[0]
94 bbox = list(map(float, match))
95 gt_bbox = list(map(float, ground_truth.strip('<>').split(',')))
96
97 # 遍历每个值,检查是否在ground truth对应值的±5范围内
98 gt_x_min = gt_bbox[0]
99 gt_x_max = gt_bbox[2]
100 gt_y_min = gt_bbox[1]
101 gt_y_max = gt_bbox[3]
102 if gt_x_min<=bbox[0]<=gt_x_max and gt_y_min<=bbox[1]<=gt_y_max:
103 return 1
104 else:
105 print("wrong response: {}".format(response))
106 return 0
107
108async def process_item_async(item, client, model_name, semaphore):
109 async with semaphore:

Callers 1

process_item_asyncFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected