feat: enforce hard reject for dense text and many-face scenes

This commit is contained in:
2026-02-28 19:47:14 +08:00
parent 5210c8a86d
commit c284d79f83

View File

@@ -244,6 +244,10 @@ class ImageAnalyzer:
"表格", "检索表", "配伍表", "药物配伍", "课程表", "流程表", "说明表", "数据表", "表格", "检索表", "配伍表", "药物配伍", "课程表", "流程表", "说明表", "数据表",
"word wall", "poster wall", "bulletin board", "word wall", "poster wall", "bulletin board",
) )
MANY_FACES_SUBJECT_KEYWORDS = (
"多人", "多人脸", "人群", "群像", "合照", "集体照", "全家福", "毕业照", "婚礼合影", "大合照",
"crowd", "group photo", "many faces",
)
async def analyze(self, image_path: str) -> dict: async def analyze(self, image_path: str) -> dict:
""" """
@@ -624,14 +628,24 @@ class ImageAnalyzer:
price_suggest = 80 price_suggest = 80
reason += " | 大量文字分层" reason += " | 大量文字分层"
# 硬规则:密集文字类图片不接单(知识宣传栏/公告栏等) # 硬规则1文字很多>100且密密麻麻不接单
if text_amount in ["大量 (51-200 字)", "极多 (200 字以上)"] or dense_text_scene: text_gt_100 = text_amount in ["大量 (51-200 字)", "极多 (200 字以上)"]
if text_gt_100 or dense_text_scene:
feasibility = "no" feasibility = "no"
risk = "high" risk = "high"
note = "文字内容过于密集(如宣传栏/公告栏),暂不接单处理" note = "文字内容过于密集(如宣传栏/公告栏),暂不接单处理"
reason = (reason or "文字密集") + " | 密集文字场景不接单" reason = (reason or "文字密集") + " | 密集文字场景不接单"
price_suggest = 0 price_suggest = 0
# 硬规则2多人脸不接1-2 人脸可做
many_faces_scene = any(k in (subject_raw + " " + reason_raw + " " + note_raw).lower() for k in self.MANY_FACES_SUBJECT_KEYWORDS)
if has_face == "yes" and many_faces_scene:
feasibility = "no"
risk = "high"
note = "多人脸/群像场景处理风险高,暂不接单"
reason = (reason or "多人脸") + " | 多人脸场景不接单"
price_suggest = 0
# 确保是 5 的倍数 # 确保是 5 的倍数
price_suggest = round(price_suggest / 5) * 5 price_suggest = round(price_suggest / 5) * 5