-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add missing api options #1447
base: master
Are you sure you want to change the base?
Conversation
align=input_args.get("align", True), | ||
anti_spoofing=input_args.get("anti_spoofing", False), | ||
max_faces=input_args.get("max_faces"), | ||
enforce_detection= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not clean at all, for boolean arguments you can adopt this approach
enforce_detection = input_args.get("enforce_detection", "true") == "true"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your suggestion will not work for JSON because booleans in JSON are converted to Python booleans, not Python strings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still, there are redudants in your approcah. This would be better imo.
enforce_detection = input_args.get("enforce_detection", True)
if not isinstance(enforce_detection, bool):
enforce_detection = enforce_detection == "true"
bool(input_args.get("anti_spoofing", False)) | ||
if isinstance((input_args.get("anti_spoofing", False)), bool) | ||
else input_args.get("anti_spoofing") == "true", | ||
max_faces= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for float args, you can adopt this approach
max_faces = int(input_args.get("max_faces", "0"))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your suggestion will not work for JSON because numbers in JSON are converted to Python numbers, not Python strings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not to call input_args.get("max_faces", None) twice, you may consider to do this as
max_faces = input_args.get("max_faces", 0)
if not isinstance(max_faces, (int, float)):
max_faces = float(max_faces) if max_faces.replace(".", "", 1).isdigit() else 0
Tickets
N/A
What has been done
Added missing options to API endpoints, such as
expand_percentage
,normalization
, andthreshold
.How to test