Spaces:
Running
Running
yasir
commited on
Update script.js
Browse files
script.js
CHANGED
|
@@ -79,12 +79,14 @@ let nps = ' ,deformed fingers,mutated hands,unrealistic hands,extra fingers,less
|
|
| 79 |
}
|
| 80 |
|
| 81 |
isf = false
|
|
|
|
| 82 |
reload = false
|
| 83 |
let fullPrompt = inp.value+prompt
|
| 84 |
setTimeout(()=>{
|
| 85 |
reload = true
|
| 86 |
},200000)
|
| 87 |
btn.onclick = async ()=>{
|
|
|
|
| 88 |
let id = ''
|
| 89 |
if(reload == true){
|
| 90 |
window.location.reload();
|
|
@@ -167,6 +169,11 @@ if (selectedIndex === -1) {
|
|
| 167 |
url2 = 'https://hacking-is-serious-illegal-crime-you.onrender.com/foocus'
|
| 168 |
isf = true
|
| 169 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
}
|
| 171 |
negative_prompt = nps
|
| 172 |
btn.disabled = true
|
|
@@ -179,13 +186,14 @@ document.getElementById('imshow').append(pi)
|
|
| 179 |
let count = 0;
|
| 180 |
seed = seed
|
| 181 |
async function generate(){
|
| 182 |
-
|
| 183 |
-
|
| 184 |
'prompt': fullPrompt,
|
| 185 |
'negative_prompt': np.value+nps,
|
| 186 |
"steps": step.value,
|
| 187 |
'gd': gd.value
|
| 188 |
};
|
|
|
|
| 189 |
|
| 190 |
try {
|
| 191 |
const response = await fetch(url, {
|
|
@@ -196,6 +204,9 @@ async function generate(){
|
|
| 196 |
},
|
| 197 |
body: JSON.stringify(params)
|
| 198 |
});
|
|
|
|
|
|
|
|
|
|
| 199 |
/* console.log(np.value)
|
| 200 |
const imgData = await response.text();
|
| 201 |
const div = document.getElementById('imshow')
|
|
@@ -215,12 +226,14 @@ async function generate(){
|
|
| 215 |
console.error('An error occurred:', error);
|
| 216 |
pi.innerText = 'An error occurred, try changing your prompt';
|
| 217 |
}
|
|
|
|
|
|
|
| 218 |
}
|
| 219 |
|
| 220 |
-
await Promise.all([generate()
|
| 221 |
|
| 222 |
setTimeout(()=>{
|
| 223 |
-
|
| 224 |
const id = idlist[1].trim().replace(/^"|"$/g, '');
|
| 225 |
fetch(url2, {
|
| 226 |
method: 'POST',
|
|
@@ -246,7 +259,7 @@ fetch(url2, {
|
|
| 246 |
console.error('An error occurred:', error);
|
| 247 |
pi.innerText = 'An error occurred, try changing your prompt';
|
| 248 |
});
|
| 249 |
-
}
|
| 250 |
function final1(){
|
| 251 |
const id = idlist[0].trim().replace(/^"|"$/g, '');
|
| 252 |
fetch(url2, {
|
|
@@ -276,7 +289,7 @@ fetch(url2, {
|
|
| 276 |
});
|
| 277 |
}
|
| 278 |
|
| 279 |
-
|
| 280 |
final1()
|
| 281 |
},8000)
|
| 282 |
|
|
|
|
| 79 |
}
|
| 80 |
|
| 81 |
isf = false
|
| 82 |
+
|
| 83 |
reload = false
|
| 84 |
let fullPrompt = inp.value+prompt
|
| 85 |
setTimeout(()=>{
|
| 86 |
reload = true
|
| 87 |
},200000)
|
| 88 |
btn.onclick = async ()=>{
|
| 89 |
+
let isc = false
|
| 90 |
let id = ''
|
| 91 |
if(reload == true){
|
| 92 |
window.location.reload();
|
|
|
|
| 169 |
url2 = 'https://hacking-is-serious-illegal-crime-you.onrender.com/foocus'
|
| 170 |
isf = true
|
| 171 |
}
|
| 172 |
+
if(selectedOption.value == 'cas'){
|
| 173 |
+
url = 'https://flask-hello-world-murex-sigma.vercel.app/cascade'
|
| 174 |
+
url2 = 'https://hacking-is-serious-illegal-crime-you.onrender.com/cascade'
|
| 175 |
+
isc = true
|
| 176 |
+
}
|
| 177 |
}
|
| 178 |
negative_prompt = nps
|
| 179 |
btn.disabled = true
|
|
|
|
| 186 |
let count = 0;
|
| 187 |
seed = seed
|
| 188 |
async function generate(){
|
| 189 |
+
params={
|
| 190 |
+
|
| 191 |
'prompt': fullPrompt,
|
| 192 |
'negative_prompt': np.value+nps,
|
| 193 |
"steps": step.value,
|
| 194 |
'gd': gd.value
|
| 195 |
};
|
| 196 |
+
|
| 197 |
|
| 198 |
try {
|
| 199 |
const response = await fetch(url, {
|
|
|
|
| 204 |
},
|
| 205 |
body: JSON.stringify(params)
|
| 206 |
});
|
| 207 |
+
if (response.status === 429) {
|
| 208 |
+
pi.innerText = 'you have reached your limit of 50 generation per hour, you will get 50 more image generaions after an hour!!'
|
| 209 |
+
}
|
| 210 |
/* console.log(np.value)
|
| 211 |
const imgData = await response.text();
|
| 212 |
const div = document.getElementById('imshow')
|
|
|
|
| 226 |
console.error('An error occurred:', error);
|
| 227 |
pi.innerText = 'An error occurred, try changing your prompt';
|
| 228 |
}
|
| 229 |
+
|
| 230 |
+
|
| 231 |
}
|
| 232 |
|
| 233 |
+
await Promise.all([generate()]);
|
| 234 |
|
| 235 |
setTimeout(()=>{
|
| 236 |
+
/* function final2(){
|
| 237 |
const id = idlist[1].trim().replace(/^"|"$/g, '');
|
| 238 |
fetch(url2, {
|
| 239 |
method: 'POST',
|
|
|
|
| 259 |
console.error('An error occurred:', error);
|
| 260 |
pi.innerText = 'An error occurred, try changing your prompt';
|
| 261 |
});
|
| 262 |
+
}*/
|
| 263 |
function final1(){
|
| 264 |
const id = idlist[0].trim().replace(/^"|"$/g, '');
|
| 265 |
fetch(url2, {
|
|
|
|
| 289 |
});
|
| 290 |
}
|
| 291 |
|
| 292 |
+
|
| 293 |
final1()
|
| 294 |
},8000)
|
| 295 |
|