Skip to content

Commit e556c5a

Browse files
author
Artsiom Khadzkou
committed
Added options in Global Compreface
1 parent 36f708a commit e556c5a

24 files changed

+118
-120
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,9 @@ Thumbs.db
9292
.history
9393
.ionide
9494

95-
95+
# Vscode
9696
.vscode
97+
98+
#Idea
99+
.idea
100+
.idea/*

.idea/.gitignore

Lines changed: 0 additions & 8 deletions
This file was deleted.

.idea/compreface-python-sdk.iml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.idea/inspectionProfiles/profiles_settings.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.idea/misc.xml

Lines changed: 0 additions & 4 deletions
This file was deleted.

.idea/modules.xml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.idea/vcs.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

compreface/client/verify_face_from_image.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
from compreface.common.multipart_constructor import multipart_constructor_with_two_images
1818
import requests
1919
from compreface.config.api_list import VERIFICATION_API
20-
import os
21-
22-
from requests_toolbelt.multipart.encoder import MultipartEncoder
2320
from compreface.common.typed_dict import ExpandedOptionsDict, check_fields_by_name
2421
from compreface.common.client import ClientRequest
2522

@@ -42,8 +39,8 @@ def get(self):
4239
"""
4340
POST request for verify face in image using source and target images.
4441
45-
:param source_image_path: Path to source image in file system.
46-
:param target_image_path: Path to target image in file system.
42+
:param source_image: Path to source image in file system.
43+
:param target_image: Path to target image in file system.
4744
:param image_id: subject id from previously added image.
4845
:param options: dictionary with options for server.
4946

compreface/collections/face_collections.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
permissions and limitations under the License.
1515
"""
1616

17-
from compreface.common.typed_dict import ExpandedOptionsDict, DetProbOptionsDict
17+
from compreface.common.typed_dict import AllOptionsDict, ExpandedOptionsDict, DetProbOptionsDict, pass_dict
1818
from ..use_cases import (
1919
AddExampleOfSubject,
2020
ListOfAllSavedSubjects,
@@ -25,10 +25,11 @@
2525

2626

2727
class FaceCollection:
28-
def __init__(self, api_key: str, domain: str, port: str):
28+
def __init__(self, api_key: str, domain: str, port: str, options: AllOptionsDict = {}):
2929
"""Init service with define API Key"""
3030
self.available_services = []
3131
self.api_key = api_key
32+
self.options = options
3233
self.add_example: AddExampleOfSubject = AddExampleOfSubject(
3334
domain=domain,
3435
port=port,
@@ -67,7 +68,7 @@ def add(self, image_path: str, subject: str, options: DetProbOptionsDict = {}) -
6768
image_path=image_path,
6869
subject=subject
6970
)
70-
return self.add_example.execute(request, options)
71+
return self.add_example.execute(request, pass_dict(options, DetProbOptionsDict) if options == {} else options)
7172

7273
def list(self) -> dict:
7374
"""
@@ -112,4 +113,4 @@ def verify(self, image_path: str, image_id: str, options: ExpandedOptionsDict =
112113
image_path=image_path,
113114
image_id=image_id
114115
)
115-
return self.verify_face_from_image.execute(request, options)
116+
return self.verify_face_from_image.execute(request, pass_dict(options, ExpandedOptionsDict) if options == {} else options)

0 commit comments

Comments
 (0)