Skip to content

Integrate app with FaceAPI#59

Merged
c-w merged 18 commits intomasterfrom
face-api-integration
Aug 20, 2018
Merged

Integrate app with FaceAPI#59
c-w merged 18 commits intomasterfrom
face-api-integration

Conversation

@c-w
Copy link
Contributor

@c-w c-w commented Aug 16, 2018

Also: implement /findsimilar algorithm

@c-w c-w force-pushed the face-api-integration branch from ab909a6 to 5e94c05 Compare August 16, 2018 19:24
@c-w c-w force-pushed the face-api-integration branch from 63b3f7a to bc4a7a7 Compare August 16, 2018 21:09
@c-w c-w force-pushed the face-api-integration branch from ecd8b13 to d0b8e63 Compare August 17, 2018 14:51
large_face_list_id=model_id)
matches.extend(face_matches)

face_id_to_confidence = {} # type: Dict[str, float]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an advantage to adding types in the comments vs.
face_id_to_confidence: Dict[str, float} = {}? Usually I do not like comments because they go stale, but in this case, the typechecker would pick up it up, so that is not a problem, so genuinely curious if there is an advantage (if it is just style, please feel free to ignore :))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable annotations were only added in Python 3.6 (see PEP), so using the comment means that the code will also work in Python 3.5.


def delete_models(database_engine):
Base.metadata.drop_all(database_engine)
class ImageStatusEnum(Enum):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these values have meaning or would it possible to use auto()?

Copy link
Contributor Author

@c-w c-w Aug 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, definitely. If we stored the enum as an int in the DB, we shouldn't use auto, but we're storing them as strings so auto will be fine. Done in 8744e33.



# pylint: disable=broad-except
@contextmanager
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is such a good use of contextmanager!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Custom context managers are a very nice way to clean up code. Definitely a powerful tool worth learning.

@c-w c-w merged commit 72fa19c into master Aug 20, 2018
@c-w c-w deleted the face-api-integration branch August 20, 2018 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants