PHP code example of rulilg / laravel-stable-diffusion
1. Go to this page and download the library: Download rulilg/laravel-stable-diffusion 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/ */
rulilg / laravel-stable-diffusion example snippets
use RuliLG\StableDiffusion\StableDiffusion;
use RuliLG\StableDiffusion\Prompt;
StableDiffusion::make()
->withPrompt(
Prompt::make()
->with('a panda sitting on the streets of New York after a long day of walking')
->photograph()
->resolution8k()
->trendingOnArtStation()
->highlyDetailed()
->dramaticLighting()
->octaneRender()
)
->generate(4);
use RuliLG\StableDiffusion\StableDiffusion;
// we get the Replicate ID and fetch the results back.
// This method will automatically update the record with the new information
$freshResults = StableDiffusion::get($result->replicate_id);
if ($freshResults->is_successful) {
dd($freshResults->output); // List of URLs with the images
}
use RuliLG\StableDiffusion\Models\StableDiffusionResult;
use RuliLG\StableDiffusion\StableDiffusion;
$results = StableDiffusionResult::unfinished()->get();
foreach ($results as $result) {
StableDiffusion::get($result->replicate_id);
}