Skip to content

Commit

Permalink
add deepface version
Browse files Browse the repository at this point in the history
  • Loading branch information
Gummibeer committed Dec 19, 2024
1 parent 392208f commit 6bdcf53
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions scripts/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import json;
from deepface import DeepFace;

print(json.dumps(DeepFace.__version__, default=str))
10 changes: 9 additions & 1 deletion src/DeepFace.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ public function __construct(?string $python = null)
);
}

public function version(): string
{
return $this->run(
filepath: __DIR__.'/../scripts/version.py',
data: [],
);
}

public function buildModel(FaceRecognitionModel|FacialAttributeModel $model_name): bool
{
return $this->run(
Expand Down Expand Up @@ -330,7 +338,7 @@ public function represent(
);
}

protected function run(string $filepath, array $data): array|bool
protected function run(string $filepath, array $data): array|bool|string
{
$script = $this->script($filepath, $data);
$process = $this->process($script);
Expand Down
6 changes: 6 additions & 0 deletions tests/Feature/DeepfaceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
use Astrotomic\DeepFace\Enums\Race;
use PHPUnit\Framework\Assert;

it('version', function (): void {
$version = $this->deepface()->version();

Assert::assertSame('0.0.93', $version);
});

describe('verify', function (): void {
it('verify: img1', function (): void {
$img1 = $this->image('img1.jpg');
Expand Down

0 comments on commit 6bdcf53

Please sign in to comment.