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

Function verify

eval/grounding_eval/code/Aguvis/text2bbox_eval_aguvis.py:84–107  ·  view source on GitHub ↗

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

(response, ground_truth)

Source from the content-addressed store, hash-verified

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

Callers 1

process_item_asyncFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected