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

Function verify

eval/grounding_eval/code/GPT-4o/fun2bbox_eval_click.py:86–107  ·  view source on GitHub ↗

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

(response, ground_truth)

Source from the content-addressed store, hash-verified

84 return response.strip("\n").replace(" ","")
85
86async def verify(response, ground_truth):
87 """
88 接受模型的字符串输入,判断是否正确
89 """
90 pattern = r'<\d+,\d+>'
91 matches = re.findall(pattern, response)
92 # 将输入字符串转换为整数列表
93 if matches:
94 match = matches[0]
95 bbox = list(map(int, match.strip('<>').split(',')))
96 gt_bbox = list(map(int, ground_truth.strip('<>').split(',')))
97
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 print(bbox, gt_bbox)
103 if gt_x_min<=bbox[0]<=gt_x_max and gt_y_min<=bbox[1]<=gt_y_max:
104 return 1
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