PHP code example of arikislam / replicate-php-client
1. Go to this page and download the library: Download arikislam/replicate-php-client 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/ */
if ($response->isSuccessful()) {
$output = $response->getResult();
// Do something with the output, such as saving the image or displaying it
} else {
// Handle errors
$errorMessage = $response->getErrorMessage();
// Log or display the error message
}
use GuzzleHttp\Client;
use Arikislam\ReplicatePhpClient\Replicate;
$client = new Client([
'base_uri' => 'https://api.replicate.com',
'timeout' => 10.0,
]);
$replicate = new Replicate($client);
$response = $replicate->createPrediction([
// input options
]);