Astrotomic / php-deepface

A PHP adapter for the python deepface framework.
https://github.com/serengil/deepface
MIT License
35 stars 6 forks source link

Invalid syntax #17

Open verybigelephants opened 2 months ago

verybigelephants commented 2 months ago

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.
pablo-gbr commented 2 months ago

Hi, I noticed that error too. I opened a PR (#16) to fix it.

pablo-gbr commented 1 month ago

@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.