mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-02-03 20:19:45 +01:00
comments
This commit is contained in:
parent
a1ad1147e6
commit
4a35059711
@ -13,41 +13,52 @@ export default function MakeButton() {
|
||||
const addNewImage = useImageQueue((state) => state.addNewImage);
|
||||
|
||||
const makeImages = () => {
|
||||
|
||||
// the request that we have built
|
||||
const req = builtRequest();
|
||||
// the actual number of request we will make
|
||||
let requests = [];
|
||||
// the number of images we will make
|
||||
let { num_outputs } = req;
|
||||
|
||||
// if making fewer images than the parallel count
|
||||
// then it is only 1 request
|
||||
if( parallelCount > num_outputs ) {
|
||||
requests.push(num_outputs);
|
||||
}
|
||||
|
||||
else {
|
||||
// while we have at least 1 image to make
|
||||
while (num_outputs >= 1) {
|
||||
// subtract the parallel count from the number of images to make
|
||||
num_outputs -= parallelCount;
|
||||
|
||||
// if we are still 0 or greater we can make the full parallel count
|
||||
if(num_outputs <= 0) {
|
||||
requests.push(parallelCount)
|
||||
}
|
||||
// otherwise we can only make the remaining images
|
||||
else {
|
||||
requests.push(Math.abs(num_outputs))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log('requests', requests);
|
||||
|
||||
// make the requests
|
||||
requests.forEach((num, index) => {
|
||||
|
||||
console.log('num', num);
|
||||
// get the seed we want to use
|
||||
let seed = req.seed;
|
||||
if(index !== 0) {
|
||||
// we want to use a random seed for subsequent requests
|
||||
seed = useRandomSeed();
|
||||
}
|
||||
|
||||
// debugger;
|
||||
|
||||
// add the request to the queue
|
||||
addNewImage(uuidv4(), {
|
||||
...req,
|
||||
// updated the number of images to make
|
||||
num_outputs: num,
|
||||
// update the seed
|
||||
seed: seed
|
||||
})
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user