Skip to content

Commit

Permalink
improve logging, make read channels a csl
Browse files Browse the repository at this point in the history
  • Loading branch information
isaric committed Dec 16, 2023
1 parent ca53cd6 commit 3c18fc8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions face_recog/detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ def detect(self, image_url):
for d_embedding in detected_embeddings:
box = boxes[detected_embeddings.index(d_embedding)]
if self._is_match(existing, d_embedding):
logging.info("Found match")
recognized.append((existing["name"], box))
name = existing["name"]
logging.info(f"Found match - {name}")
recognized.append((name, box))
else:
unknown.append(box)

Expand Down
6 changes: 3 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

class DetectorFacade:

def __init__(self, detector, slack_verification_token, read_channel):
def __init__(self, detector, slack_verification_token, read_channels):
self.detector = detector
self.slack_verification_token = slack_verification_token
self.read_channel = read_channel
self.read_channels = read_channels

def process(self, content):
if content["token"] != self.slack_verification_token:
Expand All @@ -21,7 +21,7 @@ def process(self, content):
if "event" in content and "files" in content["event"]:
app.logger.info("Received event contains files")
# TODO: switch to manageable list of channel ids
if content["event"]["channel"] == self.read_channel:
if content["event"]["channel"] in self.read_channels:
detector.detect(content["event"]["files"][0]["url_private_download"])
else:
app.logger.info(f'Channel ID {content["event"]["channel"]} is not on read list. Skipping event')
Expand Down

0 comments on commit 3c18fc8

Please sign in to comment.