MCPcopy Create free account
hub / github.com/Hunyuan-PromptEnhancer/PromptEnhancer / eval_sample

Function eval_sample

t2i_keypoints_eval.py:180–199  ·  view source on GitHub ↗

Run the full pipeline for one benchmark sample and attach the scores.

(sample: dict, judge: GeminiJudge)

Source from the content-addressed store, hash-verified

178
179
180def 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
202def report(results: list) -> dict:

Callers 1

mainFunction · 0.85

Calls 4

prompt_enhancerFunction · 0.85
text_to_imageFunction · 0.85
build_instructionFunction · 0.85
parse_verdictFunction · 0.85

Tested by

no test coverage detected