From 286c930cdb856c9b56a8d7c84a3e908e95375100 Mon Sep 17 00:00:00 2001 From: Michal Cygankiewicz Date: Wed, 15 Nov 2023 06:10:07 +0000 Subject: [PATCH 1/5] Update StabilityAI model --- Classes/Http/Client/StabilityAiClient.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Classes/Http/Client/StabilityAiClient.php b/Classes/Http/Client/StabilityAiClient.php index f7a80ad..bdaaec4 100644 --- a/Classes/Http/Client/StabilityAiClient.php +++ b/Classes/Http/Client/StabilityAiClient.php @@ -94,15 +94,15 @@ public function image(string $text): array ], 'cfg_scale' => 7, 'clip_guidance_preset' => 'FAST_BLUE', - 'height' => 512, - 'width' => 512, - 'samples' => 2, + 'height' => 1024, + 'width' => 1024, + 'samples' => 3, 'steps' => 30, ]; $response = $this->client->request( 'POST', - $this->getEndpointLink('v1/generation/stable-diffusion-512-v2-1/text-to-image'), + $this->getEndpointLink('v1/generation/stable-diffusion-xl-1024-v1-0/text-to-image'), [ 'headers' => $headers, 'body' => json_encode($params), @@ -130,7 +130,7 @@ public function createImageVariation(File $file): array 'text_prompts[0][text]' => 'variant of original image', 'cfg_scale' => '7', 'clip_guidance_preset' => 'FAST_BLUE', - 'samples' => '1', + 'samples' => '3', 'steps' => '30', ]); @@ -139,7 +139,7 @@ public function createImageVariation(File $file): array $response = $this->client->request( 'POST', - $this->getEndpointLink('v1/generation/stable-diffusion-512-v2-1/image-to-image'), + $this->getEndpointLink('v1/generation/stable-diffusion-xl-1024-v1-0/image-to-image'), [ 'headers' => $headers, 'body' => $formData->bodyToIterable(), From b888347ebd379a34581feee1d46be5b081c03351 Mon Sep 17 00:00:00 2001 From: Marc Bie Date: Fri, 17 Nov 2023 17:50:36 +0000 Subject: [PATCH 2/5] ButtonBarHook --- Classes/Backend/Hooks/ButtonBarHook.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Classes/Backend/Hooks/ButtonBarHook.php b/Classes/Backend/Hooks/ButtonBarHook.php index f3f87c0..a2c797c 100644 --- a/Classes/Backend/Hooks/ButtonBarHook.php +++ b/Classes/Backend/Hooks/ButtonBarHook.php @@ -50,6 +50,8 @@ public function getButtons(array $params, ButtonBar $buttonBar) return $buttons; } + + return $buttons; } public function buildUriToControllerAction(): string From ef3ab489ab39856a138d69b8e1d99d30636c6443 Mon Sep 17 00:00:00 2001 From: Michal Cygankiewicz Date: Mon, 13 Nov 2023 07:13:40 +0000 Subject: [PATCH 3/5] 45930 - change OpenAI image generation to DALLE-3 --- Classes/Http/Client/OpenAiClient.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Classes/Http/Client/OpenAiClient.php b/Classes/Http/Client/OpenAiClient.php index 31c4e5f..725e60a 100644 --- a/Classes/Http/Client/OpenAiClient.php +++ b/Classes/Http/Client/OpenAiClient.php @@ -34,9 +34,10 @@ public function image(string $text): array $openAi = new OpenAi($this->getApiKey()); $array = [ + 'model' => 'dall-e-3', 'prompt' => $text, - 'n' => 2, - 'size' => '256x256', + 'n' => 1, + 'size' => '1024x1024', ]; $response = $this->validateResponse($openAi->image($array)); From 1f4177a080f4ab84726a68b956511ca468401440 Mon Sep 17 00:00:00 2001 From: Michal Cygankiewicz Date: Tue, 14 Nov 2023 06:17:51 +0000 Subject: [PATCH 4/5] Generate 3 images with DALLE-3 --- Classes/Http/Client/OpenAiClient.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Classes/Http/Client/OpenAiClient.php b/Classes/Http/Client/OpenAiClient.php index 725e60a..fad5db1 100644 --- a/Classes/Http/Client/OpenAiClient.php +++ b/Classes/Http/Client/OpenAiClient.php @@ -33,16 +33,20 @@ public function image(string $text): array { $openAi = new OpenAi($this->getApiKey()); - $array = [ - 'model' => 'dall-e-3', - 'prompt' => $text, - 'n' => 1, - 'size' => '1024x1024', - ]; - - $response = $this->validateResponse($openAi->image($array)); - - $images = $this->responseToImages($response); + $images = []; + for ($i = 0; $i < 3; ++$i) { + $array = [ + 'model' => 'dall-e-3', + 'prompt' => $text, + 'n' => 1, + 'size' => '1024x1024', + ]; + + $response = $this->validateResponse($openAi->image($array)); + + $tempImages = $this->responseToImages($response); + $images = array_merge($images, $tempImages); + } return $images; } From 0622b02afafc21759e37431647d432271d47646f Mon Sep 17 00:00:00 2001 From: Michal Cygankiewicz Date: Thu, 23 Nov 2023 13:56:20 +0000 Subject: [PATCH 5/5] README update --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index aa1c7eb..08beded 100644 --- a/README.md +++ b/README.md @@ -38,5 +38,6 @@ These settings can be adjusted according to your preferences and needs. It's imp ## Changelog +- 11.0.4: use dall-e-3 model from OpenAI, use stable-diffusion-xl-1024-v1-0 from StabilityAI, fix for TCA buttons - 11.0.3: upscale and outpaint via context menu in filelist, generate image from filelist module, generate image from image content - 11.0.0: initial release for TYPO3 10.4