Мой код:
from deepface import DeepFace
from json import *
def face_verify(img_1, img_2):
try:
result_dict = DeepFace.verify(img1_path=img_1, img2_path=img_2)
with open('result.json', 'w') as file:
dump(result_dict, file, indent=4, ensure_ascii=False)
return result_dict
except Exception as _ex:
return _ex
def main():
print(face_verify(img_1='faces/skala1.jpg', img_2='faces/skala2.jpg'))
if __name__ == '__main__':
main()
Ошибка:
Object of type bool_ is not JSON serializable
Но без
with open('result.json', 'w') as file:
dump(result_dict, file, indent=4, ensure_ascii=False)
В терминале все работает нормально.