bugfixes
This commit is contained in:
parent
695592b7b6
commit
294fb339ed
@ -19,7 +19,7 @@ def translate(to_translate, lang):
|
||||
for index, label_info in to_translate.items():
|
||||
label = label_info.get("label")
|
||||
to_translate[index]["label"] = config.get(label).data
|
||||
return to_translate, None
|
||||
return to_translate, []
|
||||
except Exception as e:
|
||||
error_message = f"Error translating labels: {e}"
|
||||
print(error_message)
|
||||
|
2
main.py
2
main.py
@ -95,7 +95,7 @@ def upload_file():
|
||||
'isCat': False if not predictions else True,
|
||||
**({'predictions': predictions} if predictions is not None else {})
|
||||
}
|
||||
if error_messages is not None and predictions is None:
|
||||
if len(error_messages) > 1:
|
||||
results['errors'].append(error_messages)
|
||||
|
||||
# Send response with 200 (Success)
|
||||
|
@ -25,7 +25,7 @@ def validate(request):
|
||||
|
||||
# Case 3 -> if some of the images has wrong extension
|
||||
for img in images:
|
||||
if imghdr.what(img) not in allowed_extensions:
|
||||
if not img.filename.lower().endswith(('.png', '.jpg', '.jpeg')):
|
||||
raise ValueError(f"Given file '{img.filename}' has no allowed extension. "
|
||||
f"Allowed extensions: {allowed_extensions}.")
|
||||
except Exception as e:
|
||||
|
Loading…
Reference in New Issue
Block a user