mirror of
https://github.com/Stability-AI/StableStudio.git
synced 2026-05-17 07:25:55 +08:00
add load existing images by extension on webui
This commit is contained in:
@@ -10,6 +10,7 @@ you can open http://127.0.0.1:7861/docs to double check.
|
||||
4. once the server started, click settings to check this plugin loaded successfully or not. 
|
||||

|
||||
5. click **Dream**, your webui server should start to process your request from StableStudio.
|
||||
6. if you need to load existing from webui, you also need to install the extension [sd-webui-StableStudio](https://github.com/jtydhr88/sd-webui-StableStudio))
|
||||
|
||||
Still, currently this plugin is a basic implement for webui, and only support a few of features:
|
||||
- [x] txt2img
|
||||
@@ -21,11 +22,11 @@ Still, currently this plugin is a basic implement for webui, and only support a
|
||||
- [x] mask/inpaint/outpaint
|
||||
- [x] store settings
|
||||
- [x] webui status could replace images generated status
|
||||
- [x] load existing images (need an extension on webui: [sd-webui-StableStudio](https://github.com/jtydhr88/sd-webui-StableStudio))
|
||||
- [x] Need to think about how to deal with extensions ecosystem in webui (made a start with [sd-webui-StableStudio](https://github.com/jtydhr88/sd-webui-StableStudio))
|
||||
- [ ] upscale (working)
|
||||
- [ ] Lora support
|
||||
- [ ] load existing images
|
||||
- [ ] Lora support
|
||||
- [ ] plugin could use path in settings along with a field for extra cli flags to launch webui on startup
|
||||
- [ ] some bugs fix
|
||||
- [ ] MacOS and Linux support (since I don’t have environment with MacOS/Linux, may need someone help with this)
|
||||
- [ ] Need to think about how to deal with extensions ecosystem in webui
|
||||
- [ ] many other features from webui...
|
||||
@@ -30,6 +30,7 @@ export const createPlugin = StableStudio.createPlugin<{
|
||||
| "getStableDiffusionSamplers"
|
||||
| "getStableDiffusionDefaultCount"
|
||||
| "getStableDiffusionDefaultInput"
|
||||
| "getStableDiffusionExistingImages"
|
||||
> => {
|
||||
if (webuiHostUrl === "") {
|
||||
webuiHostUrl = "http://127.0.0.1:7861";
|
||||
@@ -292,6 +293,62 @@ export const createPlugin = StableStudio.createPlugin<{
|
||||
return samplers;
|
||||
},
|
||||
|
||||
getStableDiffusionExistingImages: async () => {
|
||||
const existingImagesUrl = webuiHostUrl + '/StableStudio/get-generated-images';
|
||||
|
||||
const data = {
|
||||
limit: 10
|
||||
}
|
||||
|
||||
const existingImagesResponse = await fetch(existingImagesUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
|
||||
if (!existingImagesResponse.ok) {
|
||||
console.warn("unable to get existing data from webui");
|
||||
}
|
||||
|
||||
const responseData = await existingImagesResponse.json();
|
||||
|
||||
const images = [];
|
||||
|
||||
for (let i = 0; i < responseData.length; i++) {
|
||||
const blob = await base64ToBlob(responseData[i].content, 'image/jpeg');
|
||||
|
||||
const createdAt = new Date();
|
||||
|
||||
const stableDiffusionImage = {
|
||||
id: responseData[i].image_name,
|
||||
createdAt: createdAt,
|
||||
blob: blob,
|
||||
input: {
|
||||
prompts: [],
|
||||
style: "",
|
||||
steps: -1,
|
||||
seed: -1,
|
||||
model: "",
|
||||
width: responseData[i].width,
|
||||
height: responseData[i].height
|
||||
}
|
||||
}
|
||||
|
||||
images.push(stableDiffusionImage)
|
||||
}
|
||||
|
||||
const stableDiffusionImages = {
|
||||
id: `${Math.random() * 10000000}`,
|
||||
images: images
|
||||
}
|
||||
|
||||
console.log(responseData);
|
||||
|
||||
return [stableDiffusionImages]
|
||||
},
|
||||
|
||||
imagesGeneratedSoFar: 0,
|
||||
|
||||
settings: {
|
||||
|
||||
Reference in New Issue
Block a user