Skip to content

Commit 0c968a6

Browse files
committed
Adds idris
1 parent 6f6aa17 commit 0c968a6

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

deepstack/core.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,20 @@
1111
TIMEOUT = 30 # seconds
1212

1313

14+
def format_confidence(confidence):
15+
"""Takes a confidence from the API like
16+
0.55623 and returne 55.6 (%).
17+
"""
18+
return round(float(confidence)*100, 1)
19+
20+
1421
def get_matched_faces(predictions: dict):
1522
"""
1623
Get the predicted faces and their confidence.
1724
"""
1825
matched_faces = {}
1926
matched_faces = {
20-
face["userid"]: round(face["confidence"] * 100, 1)
27+
face["userid"]: format_confidence(face["confidence"])
2128
for face in predictions
2229
if not face["userid"] == "unknown"
2330
}
@@ -42,6 +49,9 @@ def __init__(self, ip_address: str, port: str):
4249
self._faces = None
4350
self._matched = {}
4451

52+
def register_face(self, file_path: str, userid: str):
53+
"""Register a face with Deepstack."""
54+
4555
def process_file(self, file_path: str):
4656
"""Process an image file."""
4757
with open(file_path, "rb") as image_bytes:

tests/images/idris.jpg

205 KB
Loading

0 commit comments

Comments
 (0)