-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '12.4-outpaint-stabilityai' into '12.4'
Extending image in StabilityAI, prompt field in extending See merge request typo3-commons/mkcontentai!40
- Loading branch information
Showing
16 changed files
with
323 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* Copyright notice | ||
* | ||
* (c) DMK E-BUSINESS GmbH <dev@dmk-ebusiness.de> | ||
* All rights reserved | ||
* | ||
* This file is part of TYPO3 CMS-based extension "mkcontentai" by DMK E-BUSINESS GmbH. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
*/ | ||
|
||
namespace DMK\MkContentAi\Http\Client\Action; | ||
|
||
class AltTextAction extends BaseAction | ||
{ | ||
public const API_LINK = 'https://alttext.ai/api/'; | ||
|
||
public function getActions(): array | ||
{ | ||
return [ | ||
'altText' => 'v1/images', | ||
'altTextByAssetId' => 'v1/images/%s', | ||
'account' => 'v1/account', | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* Copyright notice | ||
* | ||
* (c) DMK E-BUSINESS GmbH <dev@dmk-ebusiness.de> | ||
* All rights reserved | ||
* | ||
* This file is part of TYPO3 CMS-based extension "mkcontentai" by DMK E-BUSINESS GmbH. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
*/ | ||
|
||
namespace DMK\MkContentAi\Http\Client\Action; | ||
|
||
abstract class BaseAction | ||
{ | ||
/** | ||
* @return array<string,string> | ||
*/ | ||
abstract public function getActions(): array; | ||
|
||
/** | ||
* @param string[] $params | ||
*/ | ||
public function buildUrl(string $actionName, array $params = []): string | ||
{ | ||
if (!array_key_exists($actionName, $this->getActions())) { | ||
throw new \Exception(sprintf('Action with name %s not found', $actionName)); | ||
} | ||
|
||
$url = $this->getActions()[$actionName]; | ||
|
||
return vsprintf($url, $params); | ||
} | ||
|
||
/** | ||
* @param string[] $params | ||
*/ | ||
public function buildFullUrl(string $apiLink, string $actionName, array $params = []): string | ||
{ | ||
return $apiLink.$this->buildUrl($actionName, $params); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* Copyright notice | ||
* | ||
* (c) DMK E-BUSINESS GmbH <dev@dmk-ebusiness.de> | ||
* All rights reserved | ||
* | ||
* This file is part of TYPO3 CMS-based extension "mkcontentai" by DMK E-BUSINESS GmbH. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
*/ | ||
|
||
namespace DMK\MkContentAi\Http\Client\Action; | ||
|
||
class StabilityAiAction extends BaseAction | ||
{ | ||
public const API_LINK = 'https://api.stability.ai/'; | ||
|
||
public function getActions(): array | ||
{ | ||
return [ | ||
'image' => 'v1/generation/stable-diffusion-xl-1024-v1-0/text-to-image', | ||
'imageVariation' => 'v1/generation/stable-diffusion-xl-1024-v1-0/image-to-image', | ||
'account' => 'v1/user/account', | ||
'upscale' => 'v1/generation/esrgan-v1-x2plus/image-to-image/upscale', | ||
'extend' => 'v2beta/stable-image/edit/outpaint', | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* Copyright notice | ||
* | ||
* (c) DMK E-BUSINESS GmbH <dev@dmk-ebusiness.de> | ||
* All rights reserved | ||
* | ||
* This file is part of TYPO3 CMS-based extension "mkcontentai" by DMK E-BUSINESS GmbH. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
*/ | ||
|
||
namespace DMK\MkContentAi\Http\Client\Action; | ||
|
||
class StableDiffusionAction extends BaseAction | ||
{ | ||
public const API_LINK = 'https://stablediffusionapi.com/api/v3/'; | ||
public const DREAMBOOTH_API_LINK = 'https://stablediffusionapi.com/api/v4/dreambooth/'; | ||
|
||
public function getActions(): array | ||
{ | ||
return [ | ||
'system_load' => 'system_load', | ||
'img2img' => 'img2img', | ||
'text2img' => 'text2img', | ||
'model_list' => 'model_list', | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.