@@ -91,14 +91,16 @@ async def list_ids_async(group_id: str) -> List[str]:
91
91
return await request_async ('GET' , url )
92
92
93
93
94
- def add_person (group_id : str , person_id : str , face_template : str ):
94
+ def add_person (group_id : str , person_id : str , face_template : str , duplicate_check = False ):
95
95
"""Add a person to a group.
96
96
:param group_id:
97
97
ID of the group. `group_id` is created in `group.create`.
98
98
:param person_id:
99
99
Person ID.
100
100
:param face_template:
101
101
Biometric template to be associated with the provided `person_id` (obtained from `face.process`).
102
+ :param duplicate_check:
103
+ Set True to check if a template already exists with a different person_id.
102
104
:return:
103
105
"""
104
106
if group_id is None :
@@ -107,11 +109,12 @@ def add_person(group_id: str, person_id: str, face_template: str):
107
109
raise ValueError ("Person ID must be specified." )
108
110
109
111
url = f'gallery/{ group_id } /{ person_id } '
110
- template_request = Template (template = face_template ).model_dump (mode = 'json' )
112
+ template_request = Template (
113
+ template = face_template , duplicate_check = duplicate_check ).model_dump (mode = 'json' )
111
114
request ('POST' , url , json = template_request )
112
115
113
116
114
- async def add_person_async (group_id : str , person_id : str , face_template : str ):
117
+ async def add_person_async (group_id : str , person_id : str , face_template : str , duplicate_check = False ):
115
118
"""
116
119
Add a person to a group.
117
120
Performs the request asynchronously.
@@ -121,6 +124,8 @@ async def add_person_async(group_id: str, person_id: str, face_template: str):
121
124
Person ID.
122
125
:param face_template:
123
126
Biometric template to be associated with the provided `person_id` (obtained from `face.process`).
127
+ :param duplicate_check:
128
+ Set True to check if a template already exists with a different person_id.
124
129
:return:
125
130
"""
126
131
if group_id is None :
@@ -129,7 +134,8 @@ async def add_person_async(group_id: str, person_id: str, face_template: str):
129
134
raise ValueError ("Person ID must be specified." )
130
135
131
136
url = f'gallery/{ group_id } /{ person_id } '
132
- template_request = Template (template = face_template ).model_dump (mode = 'json' )
137
+ template_request = Template (
138
+ template = face_template , duplicate_check = duplicate_check ).model_dump (mode = 'json' )
133
139
await request_async ('POST' , url , json = template_request )
134
140
135
141
0 commit comments