Run the full pipeline for one benchmark sample and attach the scores.
(sample: dict, judge: GeminiJudge)
| 178 | |
| 179 | |
| 180 | def eval_sample(sample: dict, judge: GeminiJudge) -> dict: |
| 181 | """Run the full pipeline for one benchmark sample and attach the scores.""" |
| 182 | prompt = sample["prompt"] |
| 183 | enhanced_prompt = prompt_enhancer(prompt) |
| 184 | sample["reprompt"] = enhanced_prompt |
| 185 | |
| 186 | image = text_to_image(enhanced_prompt) |
| 187 | |
| 188 | scores = [] |
| 189 | for key_point, key_point_desc in zip( |
| 190 | sample["prompt_points"], sample["prompt_points_des"] |
| 191 | ): |
| 192 | instruction = build_instruction( |
| 193 | prompt, key_point, key_point_desc, sample["language"] |
| 194 | ) |
| 195 | verdict = judge(instruction, image) |
| 196 | scores.append(parse_verdict(verdict)) |
| 197 | |
| 198 | sample["res_score_list"] = scores |
| 199 | return sample |
| 200 | |
| 201 | |
| 202 | def report(results: list) -> dict: |
no test coverage detected