Skip to content

no responce #7

@ingeniousgenius

Description

@ingeniousgenius

I am trying to make a script using the code samples you have, the script loops through a database and detects a face to get a face_id which is then added to a faceset. The faceset has already been made but I am getting no responces.

The code I am using is much like the demo,

<?php

require_once 'facepp_sdk.php';

$facepp = new Facepp();
$facepp->api_key = 'API KEY (PRIVACY)';
$facepp->api_secret = 'API SECRET';

$servername = "localhost";
$username = "root";
$password = 'root';
$dbname = "face_dev";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

#loop through the table 'faces' in the databse
$sql = "SELECT * FROM faces LIMIT 10";
$result = $conn->query($sql);

if ($result->num_rows > 0) { 
    while($row = $result->fetch_assoc()) {
        #strip white spaces from the name
        $name = $row['profile_name'];
        $name = preg_replace('/\s+/', '', $name);
        
        #add commas in between the name and the ID to be seperated in the app
        $tags_array = array($name, $row['profile_id']);
        $tags = implode(",", $tags_array);
        
        #detect server image 
        $params['url'] = $row['profile_image_url'];
        $params['tag'] = $tags;
        $response = $facepp->execute('/detection/detect', $params);
        print_r($responce);
        
        #json decode
        $data = json_decode($responce['body'], 1);
        
        foreach ($data['face'] as $face) {
            $responce = $facepp->execute('/faceset/add_face', array('face_id' => $face['face_id'], 'faceset_name' => 'Faces'));
            print_r($responce['body']);
        }
        
    }
}

$conn->close();

?>](url)

that's the file I am using, when I run it I am left with no responce. Nothing at all just a blank screen despite my various print_r statements. Nothing comes up in the console either just to add. I am using the exact script from the SDK with a server change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions