Skip to content

Commit afad6dd

Browse files
author
Artsiom Khadzkou
committed
Changed readme.md
1 parent 1492474 commit afad6dd

14 files changed

+59
-165
lines changed

README.md

Lines changed: 37 additions & 133 deletions
Large diffs are not rendered by default.

compreface/client/detect_face_from_image.py

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

17-
from compreface.common.multipart_constructor import multipart_constructor
18-
import os
1917
import requests
20-
from compreface.common.typed_dict import AllOptionsDict, check_fields_by_name
18+
from compreface.common.multipart_constructor import multipart_constructor
19+
from compreface.common.typed_dict import ExpandedOptionsDict, check_fields_by_name
2120
from ..common import ClientRequest
2221
from compreface.config.api_list import DETECTION_API
23-
from requests_toolbelt.multipart.encoder import MultipartEncoder
2422

2523

2624
class DetectFaceFromImageClient(ClientRequest):
@@ -46,7 +44,7 @@ def get(self):
4644
:return: json from server.
4745
"""
4846

49-
def post(self, image: str = '' or bytes, options: AllOptionsDict = {}):
47+
def post(self, image: str = '' or bytes, options: ExpandedOptionsDict = {}):
5048
url: str = self.url + '?'
5149

5250
# Validation loop and adding fields to the url.

compreface/client/recognize_face_from_image.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,11 @@
1313
or implied. See the License for the specific language governing
1414
permissions and limitations under the License.
1515
"""
16+
import requests
1617

1718
from compreface.common.multipart_constructor import multipart_constructor
18-
from compreface.common.typed_dict import ExpandedOptionsDict, check_fields_by_name
19+
from compreface.common.typed_dict import AllOptionsDict, check_fields_by_name
1920
from compreface.config.api_list import RECOGNIZE_API
20-
import os
21-
import requests
22-
from requests_toolbelt.multipart.encoder import MultipartEncoder
23-
2421
from ..common import ClientRequest
2522

2623

@@ -47,7 +44,7 @@ def get(self):
4744
:return: json from server.
4845
"""
4946

50-
def post(self, image: str = '' or bytes, options: ExpandedOptionsDict = {}):
47+
def post(self, image: str = '' or bytes, options: AllOptionsDict = {}):
5148
url: str = self.url + "?"
5249

5350
# Validation loop and adding fields to the url.

compreface/client/verify_face_from_image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import os
2121

2222
from requests_toolbelt.multipart.encoder import MultipartEncoder
23-
from compreface.common.typed_dict import AllOptionsDict, check_fields_by_name
23+
from compreface.common.typed_dict import ExpandedOptionsDict, check_fields_by_name
2424
from compreface.common.client import ClientRequest
2525

2626

@@ -53,7 +53,7 @@ def get(self):
5353
def post(self,
5454
source_image: str = '' or bytes,
5555
target_image: str = '' or bytes,
56-
options: AllOptionsDict = {}) -> dict:
56+
options: ExpandedOptionsDict = {}) -> dict:
5757

5858
url: str = self.url + '/verify?'
5959
# Validation loop and adding fields to the url.

compreface/common/typed_dict.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ class DetProbOptionsDict(TypedDict):
2424

2525
class ExpandedOptionsDict(DetProbOptionsDict):
2626
limit: int
27-
prediction_count: int
2827
status: bool
28+
face_plugins: str
2929

3030

3131
class AllOptionsDict(ExpandedOptionsDict):
32-
face_plugins: str
32+
prediction_count: int
3333

3434

3535
"""

compreface/service/detection_service.py

Lines changed: 2 additions & 2 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 AllOptionsDict
17+
from compreface.common.typed_dict import ExpandedOptionsDict
1818
from compreface.use_cases.detect_face_from_image import DetectFaceFromImage
1919
from typing import List
2020

@@ -41,7 +41,7 @@ def get_available_functions(self) -> List[str]:
4141
"""
4242
return self.available_services
4343

44-
def detect(self, image_path: str, options: AllOptionsDict = {}) -> dict:
44+
def detect(self, image_path: str, options: ExpandedOptionsDict = {}) -> dict:
4545
"""
4646
Detect face in image
4747
:param image_path:

compreface/service/recognition_service.py

Lines changed: 2 additions & 2 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
17+
from compreface.common.typed_dict import AllOptionsDict
1818
from typing import List
1919

2020
from ..common import Service
@@ -49,7 +49,7 @@ def get_available_functions(self) -> List[str]:
4949
"""
5050
return self.available_services
5151

52-
def recognize(self, image_path: str, options: ExpandedOptionsDict = {}) -> dict:
52+
def recognize(self, image_path: str, options: AllOptionsDict = {}) -> dict:
5353
"""
5454
Recognize image
5555
:param image_path:

compreface/service/verification_service.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515
"""
1616

1717
from compreface.use_cases.verifiy_face_from_images import VerifyFaceFromImage
18-
from requests.api import request
19-
from compreface.common.typed_dict import AllOptionsDict
18+
from compreface.common.typed_dict import ExpandedOptionsDict
2019
from compreface.client.verify_face_from_image import VerifyFaceFromImageClient
21-
from compreface.collections.face_collections import FaceCollection
2220
from typing import List
2321

2422
from ..common import Service
@@ -44,7 +42,7 @@ def get_available_functions(self) -> List[str]:
4442
"""
4543
return self.available_services
4644

47-
def verify(self, source_image_path: str, target_image_path: str, options: AllOptionsDict) -> dict:
45+
def verify(self, source_image_path: str, target_image_path: str, options: ExpandedOptionsDict) -> dict:
4846
"""
4947
Verify face in images
5048
:param source_image_path:

compreface/use_cases/detect_face_from_image.py

Lines changed: 2 additions & 2 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 AllOptionsDict
17+
from compreface.common.typed_dict import ExpandedOptionsDict
1818
from dataclasses import dataclass
1919
from ..client import DetectFaceFromImageClient
2020

@@ -33,7 +33,7 @@ def __init__(self, domain: str, port: str, api_key: str):
3333
port=port
3434
)
3535

36-
def execute(self, request: Request, options: AllOptionsDict = {}) -> dict:
36+
def execute(self, request: Request, options: ExpandedOptionsDict = {}) -> dict:
3737
result: dict = self.detect_face_from_image.post(
3838
request.image_path, options)
3939
return result

compreface/use_cases/recognize_face_from_image.py

Lines changed: 2 additions & 2 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
17+
from compreface.common.typed_dict import AllOptionsDict
1818
from dataclasses import dataclass
1919
from ..client import RecognizeFaceFromImageClient
2020

@@ -33,7 +33,7 @@ def __init__(self, domain: str, port: str, api_key: str):
3333
port=port
3434
)
3535

36-
def execute(self, request: Request, options: ExpandedOptionsDict = {}) -> dict:
36+
def execute(self, request: Request, options: AllOptionsDict = {}) -> dict:
3737
result: dict = self.recognize_face_from_image.post(
3838
request.image_path, options)
3939
return result

0 commit comments

Comments
 (0)