Skip to content

Send Multiple Images in one call with IDs #50

Description

@Trixpua

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions