fixed generation endpoints, added animation via gifs

08d5a2826fa974e9f44258e878226b1be38f0ee6

Edward Kim <edwardkim.ek@gmail.com>

3 files changed, +17 -8Ignore whitespace
public/img/blockentropy.svg+3 -0
@@ -0,0 +1,3 @@
1+<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 236.38 282.41">
2+ <path d="M126.55,0v54.44l-79.87,33.76v93.95l27.53-12.94,43.08,31.09.04-.05v.09l55.21-31.44.13-.08v-80.06l-55.34,24.92v80.2l-42.55-30.7h-.02s0-81.16,0-81.16l57.02-24.11V9.23l93.54,56.12v22.51l-24.34,11.53,1.84,90.56-88.45,51.47-.13.08v34.46L5.23,198.97v-65.56H0v66.92c0,.85.41,1.64,1.11,2.14l113.13,79.91v.05l.04-.02h0s0,0,0,0l121.97-73.54.13-.08v-126.13l-5.84,2.76v-22.94h-.3l.11-.18L126.55,0Z" fill="#000000"/>
3+</svg>
3 \ No newline at end of file
public/scripts/extensions/stable-diffusion/index.js+10 -1
@@ -2692,7 +2692,16 @@ async function generateBlockEntropyImage(prompt, negativePrompt, signal) {
26922692
26932693 if (result.ok) {
26942694 const data = await result.json();
2695- return { format: 'png', data: data.images[0] };
2695+
2696+ // Default format is 'jpg'
2697+ let format = 'jpg';
2698+
2699+ // Check if a format is specified in the result
2700+ if (data.format) {
2701+ format = data.format.toLowerCase();
2702+ }
2703+
2704+ return { format: format, data: data.images[0] };
26962705 } else {
26972706 const text = await result.text();
26982707 throw new Error(text);
src/endpoints/stable-diffusion.js+4 -7
@@ -920,7 +920,7 @@ blockentropy.post('/models', jsonParser, async (request, response) => {
920920 return response.sendStatus(400);
921921 }
922922
923923 const modelsResponse = await fetch('https://api.blockentropy.ai/sdapi/v1/schedulerssd-models', {
924924 method: 'GET',
925925 headers: {
926926 'Authorization': `Bearer ${key}`,
@@ -961,16 +961,13 @@ blockentropy.post('/generate', jsonParser, async (request, response) => {
961961 const result = await fetch('https://api.blockentropy.ai/sdapi/v1/txt2img', {
962962 method: 'POST',
963963 body: JSON.stringify({
964- request_type: 'image-model-inference',
965964 prompt: request.body.prompt,
966965 negative_prompt: request.body.negative_prompt,
967- height: request.body.height,
968- width: request.body.width,
969966 model: request.body.model,
970967 steps: request.body.steps,
971968 schedulerwidth: request.body.schedulerwidth,
972969 nheight: 1request.body.height,
973- // Limited to 10000 on playground, works fine with more.
970+ // Random seed if negative.
974971 seed: request.body.seed >= 0 ? request.body.seed : Math.floor(Math.random() * 10_000_000),
975972 }),
976973 headers: {