PHP code example of coolseven / face-platform-sdk
1. Go to this page and download the library: Download coolseven/face-platform-sdk library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
coolseven / face-platform-sdk example snippets
$facePlatformClient = app(Coolseven\FacePlatformSdk\FacePlatformClient::class);
// or $facePlatformClient = app('face-platform-client')
$faceSetName = 'your-demo-face-set';
$response = $facePlatformClient->createFaceSet($faceSetName);
$faceSetId = $response->getFaceSet()->getId();
$statusCode = $response->getRawResponse()->getStatusCode();
$facePlatformClient = app(Coolseven\FacePlatformSdk\FacePlatformClient::class);
$faceSetId = 'your-demo-face-set-id';
$imagePath = 'your_imgae_file_path';
$response = $facePlatformClient->importFaces($faceSetId, base64_encode(file_get_contents($imagePath)));
$importedFaces = $response->getImportedFaces();
$facePlatformClient = app(Coolseven\FacePlatformSdk\FacePlatformClient::class);
$faceSetId = 'your-demo-face-set-id';
$imagePath = 'your_imgae_file_path';
$similarityThreshold = 0.93;
$response = $facePlatformClient->searchSimilarFaces($faceSetId, base64_encode(file_get_contents($imagePath)), $similarityThreshold);
$similarFaces = $response->getSimilarFaces();
$accessToken = $accessTokenRefreshedEvent->getRefreshedAccessToken();
$faceSetId = $faceSetCreatedEvent->getFaceSet()->getId();
$rawResponse = $faceSetCreatedEvent->getRawResponse();
$importedFaces = $facesImportedEvent->getImportedFaces();
$faceSetId = $facesImportedEvent->getFaceSetId();
$imageBase64 = $facesImportedEvent->getImageBase64();
$rawResponse = $facesImportedEvent->getRawResponse();
$similarFaces = $similarFacesSearchedEvent->getSimilarFaces();
$faceSetId = $similarFacesSearchedEvent->getFaceSetId();
$imageBase64 = $similarFacesSearchedEvent->getImageBase64();
$rawResponse = $similarFacesSearchedEvent->getRawResponse();
bash
php artisan vendor:publish --tag=face-platform-sdk.config