Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no responce #7

Open
jesster2k10 opened this issue Dec 10, 2016 · 0 comments
Open

no responce #7

jesster2k10 opened this issue Dec 10, 2016 · 0 comments

Comments

@jesster2k10
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant