xyplon
commited on
Update static/models.js
Browse files- static/models.js +6 -1
static/models.js
CHANGED
|
@@ -94,7 +94,10 @@ function log(msg){
|
|
| 94 |
|
| 95 |
let task = 0
|
| 96 |
btn.onclick = async () => {
|
| 97 |
-
|
|
|
|
|
|
|
|
|
|
| 98 |
const params = {
|
| 99 |
'prompt': prompt.value,
|
| 100 |
'negative': negativePrompt.value,
|
|
@@ -109,6 +112,7 @@ btn.onclick = async () => {
|
|
| 109 |
|
| 110 |
|
| 111 |
async function generateImage(params) {
|
|
|
|
| 112 |
let loader = document.createElement('div')
|
| 113 |
loader.id = 'loader'
|
| 114 |
if (div.firstChild!== loader) {
|
|
@@ -164,6 +168,7 @@ btn.onclick = async () => {
|
|
| 164 |
img.src = jsonChunk.img;
|
| 165 |
if (div.firstChild!== img) {
|
| 166 |
div.insertBefore(img, div.firstChild);
|
|
|
|
| 167 |
}
|
| 168 |
|
| 169 |
} else {
|
|
|
|
| 94 |
|
| 95 |
let task = 0
|
| 96 |
btn.onclick = async () => {
|
| 97 |
+
if(task>8){
|
| 98 |
+
alert("only 4 concurrent image generation is allowed, please wait for pending generations to finish ")
|
| 99 |
+
return
|
| 100 |
+
}
|
| 101 |
const params = {
|
| 102 |
'prompt': prompt.value,
|
| 103 |
'negative': negativePrompt.value,
|
|
|
|
| 112 |
|
| 113 |
|
| 114 |
async function generateImage(params) {
|
| 115 |
+
task+=1
|
| 116 |
let loader = document.createElement('div')
|
| 117 |
loader.id = 'loader'
|
| 118 |
if (div.firstChild!== loader) {
|
|
|
|
| 168 |
img.src = jsonChunk.img;
|
| 169 |
if (div.firstChild!== img) {
|
| 170 |
div.insertBefore(img, div.firstChild);
|
| 171 |
+
task-=1
|
| 172 |
}
|
| 173 |
|
| 174 |
} else {
|