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

Send Multiple Images in one call with IDs #50

Open
Trixpua opened this issue May 12, 2018 · 0 comments
Open

Send Multiple Images in one call with IDs #50

Trixpua opened this issue May 12, 2018 · 0 comments

Comments

@Trixpua
Copy link

Trixpua commented May 12, 2018

I am trying to send multiple images with just one api call, but the result is a empty json foreach image I sent.

The code that I am using is:

foreach ($imagBase64 as $key => $imgbase64) {
    $input[$key] = new DarrynTen\Clarifai\Entity\Input();
    $input[$key]->setImage($imgbase64)->isEncoded()->setId($key);
}

$inputResult = $clarifai->getInputRepository()->add($input);


$inputResult = $clarifai->getInputRepository()->get();

$results = json_decode(json_encode($inputResult));

var_dump($results);

If I send each image in an individual API Call using the following code I get the result:

foreach ($imagBase64 as $key => $imgbase64) {
    $modelResult[$key] = $clarifai->getModelRepository()->predictEncoded(
            $imgbase64, \DarrynTen\Clarifai\Repository\ModelRepository::GENERAL
    );
}

foreach ($modelResult as $key => $result) {
    $image[$key] = json_decode(json_encode($result));
}

What I am doing wrong? I think maybe I need to set a ModelRepository, but I don't find a funtion to do this in documentation.

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