php-deepface icon indicating copy to clipboard operation
php-deepface copied to clipboard

Invalid syntax

Open verybigelephants opened this issue 1 year ago • 3 comments

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.

verybigelephants avatar Jul 25 '24 11:07 verybigelephants

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

pablo-gbr avatar Aug 01 '24 11:08 pablo-gbr

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

pablo-gbr avatar Aug 28 '24 15:08 pablo-gbr

There's a new release: https://github.com/Astrotomic/php-deepface/releases/tag/0.4.0

Gummibeer avatar Dec 20 '24 00:12 Gummibeer