fixed generation endpoints, added animation via gifs

08d5a2826fa974e9f44258e878226b1be38f0ee6

Edward Kim <edwardkim.ek@gmail.com>

3 files changed, +17 -8Showing whitespace changes
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>
\ No newline at end of file3 \ 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
2693 if (result.ok) {2693 if (result.ok) {
2694 const data = await result.json();2694 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] };
2696 } else {2705 } else {
2697 const text = await result.text();2706 const text = await result.text();
2698 throw new Error(text);2707 throw new Error(text);
src/endpoints/stable-diffusion.js+4 -7
@@ -920,7 +920,7 @@ blockentropy.post('/models', jsonParser, async (request, response) => {
920 return response.sendStatus(400);920 return response.sendStatus(400);
921 }921 }
922922
923 const modelsResponse = await fetch('https://api.blockentropy.ai/sdapi/v1/schedulers', {923 const modelsResponse = await fetch('https://api.blockentropy.ai/sdapi/v1/sd-models', {
924 method: 'GET',924 method: 'GET',
925 headers: {925 headers: {
926 'Authorization': `Bearer ${key}`,926 'Authorization': `Bearer ${key}`,
@@ -961,16 +961,13 @@ blockentropy.post('/generate', jsonParser, async (request, response) => {
961 const result = await fetch('https://api.blockentropy.ai/sdapi/v1/txt2img', {961 const result = await fetch('https://api.blockentropy.ai/sdapi/v1/txt2img', {
962 method: 'POST',962 method: 'POST',
963 body: JSON.stringify({963 body: JSON.stringify({
964 request_type: 'image-model-inference',
965 prompt: request.body.prompt,964 prompt: request.body.prompt,
966 negative_prompt: request.body.negative_prompt,965 negative_prompt: request.body.negative_prompt,
967 height: request.body.height,
968 width: request.body.width,
969 model: request.body.model,966 model: request.body.model,
970 steps: request.body.steps,967 steps: request.body.steps,
971 scheduler: request.body.scheduler,968 width: request.body.width,
972 n: 1,969 height: request.body.height,
973 // Limited to 10000 on playground, works fine with more.970 // Random seed if negative.
974 seed: request.body.seed >= 0 ? request.body.seed : Math.floor(Math.random() * 10_000_000),971 seed: request.body.seed >= 0 ? request.body.seed : Math.floor(Math.random() * 10_000_000),
975 }),972 }),
976 headers: {973 headers: {