Skip to content

Commit

Permalink
Update routes.py
Browse files Browse the repository at this point in the history
support form data for flask 3
  • Loading branch information
serengil authored Dec 19, 2024
1 parent b4ffec1 commit 4fe4ba2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions deepface/api/src/modules/core/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ def extract_image_from_request(img_key: str) -> Union[str, np.ndarray]:

@blueprint.route("/represent", methods=["POST"])
def represent():
input_args = request.get_json() or request.form.to_dict()
input_args = (request.is_json and request.get_json()) or (
request.form and request.form.to_dict()
)

try:
img = extract_image_from_request("img")
Expand All @@ -96,7 +98,9 @@ def represent():

@blueprint.route("/verify", methods=["POST"])
def verify():
input_args = request.get_json() or request.form.to_dict()
input_args = (request.is_json and request.get_json()) or (
request.form and request.form.to_dict()
)

try:
img1 = extract_image_from_request("img1")
Expand Down Expand Up @@ -126,7 +130,9 @@ def verify():

@blueprint.route("/analyze", methods=["POST"])
def analyze():
input_args = request.get_json() or request.form.to_dict()
input_args = (request.is_json and request.get_json()) or (
request.form and request.form.to_dict()
)

try:
img = extract_image_from_request("img")
Expand Down

0 comments on commit 4fe4ba2

Please sign in to comment.