feat: 新增42号人脸特征与72号B端关键点接口
This commit is contained in:
+5
-2
@@ -70,7 +70,7 @@ def get_client():
|
||||
global _client, _client_key
|
||||
key = _load_api_key()
|
||||
if not key:
|
||||
raise RuntimeError("缺少火山方舟 API Key(设 ARK_API_KEY 或 worker_config.json.ark_api_key)")
|
||||
raise RuntimeError("缺少火山方舟 API Key(设 ARK_API_KEY,或在 gateway/config.json / worker_config.json 中填写 ark_api_key)")
|
||||
# client 未建、或 key 变了 → 重建
|
||||
if _client is None or key != _client_key:
|
||||
from volcenginesdkarkruntime import Ark
|
||||
@@ -132,7 +132,10 @@ def analyze_features(image_bytes: bytes = None, image_url: str = None):
|
||||
if not has_face(raw):
|
||||
return None
|
||||
# 只保留 6 个英文字段(doubao 缺某字段则跳过)
|
||||
return {en: raw[zh] for zh, en in _KEY_MAP.items() if zh in raw}
|
||||
features = {en: raw[zh] for zh, en in _KEY_MAP.items() if zh in raw}
|
||||
if "facial_age" not in features and "面部年龄区间" in raw:
|
||||
features["facial_age"] = raw["面部年龄区间"]
|
||||
return features
|
||||
|
||||
|
||||
def has_face(features: dict) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user