Build the judge instruction for a single key point.
(prompt: str, key_point: str, key_point_desc: str, language: str)
| 158 | # Evaluation |
| 159 | # --------------------------------------------------------------------------- # |
| 160 | def build_instruction(prompt: str, key_point: str, key_point_desc: str, language: str) -> str: |
| 161 | """Build the judge instruction for a single key point.""" |
| 162 | if language == "zh": |
| 163 | return ( |
| 164 | f"该图片由 prompt:[{prompt}] 通过 AIGC 生成。请判断,基于图片画面中的可见部分," |
| 165 | f"只需要考虑 [{key_point}] 是否严格满足 [{key_point_desc}] 要求。" |
| 166 | f"accept 代表满足要求,reject 代表不满足要求。" |
| 167 | f"仅根据图片视觉呈现的可见部分(不要联想画面,不要猜测画面)," |
| 168 | f"详细分析得到结果的依据并给出结果:" |
| 169 | ) |
| 170 | return ( |
| 171 | f"This image is generated by prompt:[{prompt}] through AIGC. Please judge, " |
| 172 | f"based on the visible part of the image, only consider whether [{key_point}] " |
| 173 | f"strictly meets the [{key_point_desc}] requirement. accept means meeting the " |
| 174 | f"requirement, reject means not meeting the requirement. Only rely on the " |
| 175 | f"visible part of the image (do not associate the scene & do not guess the " |
| 176 | f"scene), analyze the basis for the result in detail and give the result:" |
| 177 | ) |
| 178 | |
| 179 | |
| 180 | def eval_sample(sample: dict, judge: GeminiJudge) -> dict: |