php-deepface
php-deepface copied to clipboard
Invalid syntax
hello,
i have tried doing everything as is in the readme,
pip install deepface
composer require astrotomic/php-deepface
however, when i do basic
$deepface = new \Astrotomic\DeepFace\DeepFace();
$deepface->extractFaces( img_path: storage_path('test.jpg'), );
i get error
Symfony\Component\Process\Exception\ProcessFailedException The command "'/usr/bin/python3' '-c' 'import json; import sys; from deepface import DeepFace; try: result = DeepFace.extract_faces( img_path = "storage/test.jpg", target_size=[224,224], enforce_detection=True, anti_spoofing=False, detector_backend="opencv", align=True, grayscale=False, ); print(json.dumps(result, default=str)) except ValueError as e: print(json.dumps({"error": str(e)}), file=sys.stderr)'" failed.
Exit Code: 1(General error)
Working directory: /home/forge/...
Output:
================
Error Output:
================
File "<string>", line 1
import json; import sys; from deepface import DeepFace; try: result = DeepFace.extract_faces( img_path = "storage/test.jpg", target_size=[224,224], enforce_detection=True, anti_spoofing=False, detector_backend="opencv", align=True, grayscale=False, ); print(json.dumps(result, default=str)) except ValueError as e: print(json.dumps({"error": str(e)}), file=sys.stderr)
^^^
SyntaxError: invalid syntax.
Hi, I noticed that error too. I opened a PR (#16) to fix it.
@verybigelephants I suggest you to clone my branch, the issue you mentioned is fixed and I updated the package to include recent changes introduced in v0.0.93 of deepface.
You need to manually include it to your project though.
There's a new release: https://github.com/Astrotomic/php-deepface/releases/tag/0.4.0