1. Go to this page and download the library: Download theranken/ruelo 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/ */
theranken / ruelo example snippets
use Ruelo\DeepFace;
$deepface = new DeepFace('http://localhost:4800'); // URL of FastAPI server
// Compare two image files
$result = $deepface->compare('path/to/image1.jpg', 'path/to/image2.jpg');
if (isset($result['result']['verified']) && $result['result']['verified']) {
echo "Match found! Distance: " . $result['result']['distance'] . "\n";
echo "Threshold: " . $result['result']['threshold'] . "\n";
echo "Model: " . $result['result']['model'] . "\n";
}
// Using a custom threshold (0.0 to 1.0)
$result = $deepface->compare('image1.jpg', 'image2.jpg', 0.5);
use Ruelo\DeepFace;
$deepface = new DeepFace('http://localhost:4800');
// Convert an image file to base64
$base64 = $deepface->fileToBase64('path/to/image.jpg');
// Compare with mixed formats
$result = $deepface->compare($base64, 'path/to/image2.jpg');
// Compare two base64 images
$base64_1 = $deepface->fileToBase64('image1.jpg');
$base64_2 = $deepface->fileToBase64('image2.jpg');
$result = $deepface->compare($base64_1, $base64_2);
// Working with data URLs
$dataUrl = 'data:image/jpeg;base64,/9j/4AAQSkZJRg...';
$result = $deepface->compare($dataUrl, 'image2.jpg');