ya_sir commited on
Commit
5cd0fe5
1 Parent(s): 43bdea0

Create script.js

Browse files
Files changed (1) hide show
  1. script.js +396 -0
script.js ADDED
@@ -0,0 +1,396 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ document.getElementById('jd').onclick = ()=>{
2
+ window.open('https://discord.gg/ju4yQBfQ7p')
3
+ }
4
+
5
+ //@sshole
6
+ // PINK PUSSY
7
+
8
+
9
+ /*document.getElementById('ow').onclick = ()=>{
10
+ window.open('https://www.buymeacoffee.com/mygx')
11
+ }*/
12
+ document.getElementById('fumes').checked = true
13
+ let dialog = document.getElementById('dialog')
14
+ let openbtn = document.getElementById('Advance Setting')
15
+ let closebtn = document.getElementById('close')
16
+ openbtn.onclick = ()=>{
17
+ dialog.show()
18
+ document.getElementById('imshow').style.border = '0px solid black transparent'
19
+ }
20
+ closebtn.onclick= ()=>{
21
+ dialog.close()
22
+ document.getElementById('imshow').style.background = 'linear-gradient(black, black) padding-box,linear-gradient(to right, red, blue) border-box'
23
+ }
24
+ let inp = document.getElementById('inp')
25
+ let np = document.getElementById('np')
26
+ let gd = document.getElementById('gds')
27
+ let cn = false
28
+ let step = document.getElementById('step')
29
+ let seed = document.getElementById('seed')
30
+ let seedp = document.getElementById('seedp')
31
+ let stepp = document.getElementById('stepp')
32
+ let gdsp = document.getElementById('gdsp')
33
+ let btn = document.getElementById('create')
34
+ gd.addEventListener('input',()=>{
35
+ gdsp.innerText = gd.value
36
+ })
37
+ step.addEventListener('input',()=>{
38
+ stepp.innerText = step.value
39
+ })
40
+ seed.addEventListener('input',()=>{
41
+ seedp.innerText = seed.value
42
+ })
43
+ isFumes = true
44
+ let prompt = ''
45
+ let nps = ' ,(bad hands, bad anatomy, bad body, bad face, bad teeth, bad arms, bad legs, deformities:1.3),poorly drawn,deformed hands,deformed fingers,deformed faces,deformed eyes,mutated fingers,deformedbody parts,mutated body parts,mutated hands, disfigured,oversaturated,bad anatom,cropped, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, out of frame, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, deformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck,deformed eyes'
46
+ document.getElementById('styles').onchange = ()=>{
47
+ const selectedStyle = document.querySelector('input[name="style"]:checked');
48
+ if(selectedStyle.value =='photo'){
49
+ isFumes = true
50
+ prompt = ' ,RAW photo, portrait photo,(high detailed skin:1. 2), 8k uhd, dslr, soft lighting, high quality, film grain, Fujifilm'
51
+ nps = ' ,NSFW,deformed fingers,mutated hands,unrealistic hands,extra fingers,less fingers,mutated eyes,malformed hands,malformed fingers,malformed faces,malfromed eyes,malformed body parts,mutated body parts,mutated fingers,mutated hands,(deformed iris, deformed pupils, semi-realistic, cgi, 3d, render, sketch, cartoon, drawing, anime:1.4), text, close up, cropped, out of frame, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck'
52
+ }
53
+ if(selectedStyle.value == 'cinema'){
54
+ isFumes = true
55
+ prompt = ' ,cinematic film still awardwinning photo, highly detailed, high budget, bokeh, cinemascope, moody, epic, gorgeous, film grain, grainy'
56
+ nps = ' ,NSFW,deformed fingers,mutated hands,unrealistic hands,extra fingers,less fingers,mutated eyes,malformed hands,malformed fingers,malformed faces,malfromed eyes,malformed body parts,mutated body parts,mutated fingers,mutated hands,(deformed iris, deformed pupils, semi-realistic, cgi, 3d, render, sketch, cartoon, drawing, anime:1.4), text, close up, cropped, out of frame, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck'
57
+ }
58
+ if(selectedStyle.value == 'real'){
59
+ isFumes = true
60
+ prompt = ' ,RAW candid cinema,Modern colors, 16mm, beautiful,attractive,color graded portra 400 film, remarkable color, ultra realistic, textured skin, remarkable detailed pupils, realistic dull skin noise, visible skin detail, skin fuzz, dry skin, shot with cinematic camera, sun soaked colors'
61
+ nps = ' ,NSFW,deformed fingers,mutated hands,unrealistic hands,extra fingers,less fingers,mutated eyes,malformed hands,malformed fingers,malformed faces,malfromed eyes,malformed body parts,mutated body parts,mutated fingers,mutated hands,poorly drawn,lowres, disfigured,bad anatomy,deformed body features ,cropped, worst quality, low quality, jpeg artifacts, ugly, duplicate, out of frame, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck,deformed eyes'
62
+ }
63
+ if(selectedStyle.value == 'fantasy'){
64
+ isFumes = true
65
+ prompt = ' ,centered shot, wide angle, full body, dd, fantasy, highly detailed, digital painting, artstation, smooth, sharp focus, digital art'
66
+ nps = ' ,NSFW,deformed fingers,mutated hands,unrealistic hands,extra fingers,less fingers,mutated eyes,malformed hands,malformed fingers,malformed faces,malfromed eyes,malformed body parts,mutated body parts,mutated fingers,mutated hands,missing legs, missing feet, worst quality, low quality, jpeg artifacts, signature, logo, watermark, text, realistic, hyper-realistic, ultra-detailed, RAW photo'
67
+ }
68
+ if(selectedStyle.value == 'anime'){
69
+ isFumes = true
70
+ prompt = ' ,masterpiece,HDR,anime,anime style,beuatiful anime'
71
+ nps = ' ,NSFW,malformed hands,malformed fingers,malformed faces,malformed body parts,mutated body parts,malfromed eyes,mutated fingers,mutated hands,realistic,worst quality, low quality, blurry, pixelated, extra limb, extra fingers, bad hand, text, name, letters, out of frame, lowres, text, error, cropped, jpeg artifacts, ugly, duplicate, morbid, mutilated, out of frame, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, username, watermark, signature'
72
+ }
73
+ if(selectedStyle.value == 'fumes'){
74
+ isFumes = true
75
+ let prompt = ' ,RAW photo,dynamic lights, photorealistic, extremely detailed informations, dynamic colors,realistic,SciFi,award winning photography,film grain,beautiful,attarctive'
76
+ let nps = ' ,NSFW,deformed fingers,mutated hands,unrealistic hands,extra fingers,less fingers,mutated eyes,poorly drawn,malformed hands,malformed fingers,malformed faces,malformed body parts,mutated body parts,malfromed eyes,mutated fingers,mutated hands, disfigured,oversaturated,bad anatomy,deformed body features ,cropped, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, out of frame, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck,deformed eyes'
77
+ }
78
+ if(selectedStyle.value == 'no'){
79
+ prompt = ''
80
+ nps = ',NSFW'
81
+ isFumes = false
82
+ }
83
+ }
84
+
85
+ isf = false
86
+ let isreal = false
87
+ reload = false
88
+ let fullPrompt = inp.value+prompt
89
+ setTimeout(()=>{
90
+ reload = true
91
+ },200000)
92
+ btn.onclick = async ()=>{
93
+ if(cn==true){
94
+ window.location.reload()
95
+ }
96
+ btn.innerText = "CANCEL"
97
+ cn = true
98
+ let isc = false
99
+ let id = ''
100
+
101
+
102
+
103
+
104
+ let url2 = 'https://flask-hello-world-murex-sigma.vercel.app/status'
105
+ let idlist = []
106
+ url = 'https://flask-hello-world-murex-sigma.vercel.app/predict'
107
+ var selectElement = document.getElementById("model");
108
+ var selectedIndex = selectElement.selectedIndex;
109
+ if (selectedIndex === -1) {
110
+ console.log("No option is selected.");
111
+ } else {
112
+ var selectedOption = selectElement.options[selectedIndex];
113
+
114
+ if(selectedOption.value == 'rv6'){
115
+ url = 'https://flask-hello-world-murex-sigma.vercel.app/proteus'
116
+ isreal = false
117
+ }
118
+ if(selectedOption.value == 'ds8'){
119
+ url = 'https://flask-hello-world-murex-sigma.vercel.app/dream'
120
+ if(step.value>50){
121
+ step.value = 50
122
+ }
123
+ isreal = false
124
+ }
125
+ if(selectedOption.value == 'ra'){
126
+ url = 'https://flask-hello-world-murex-sigma.vercel.app/playground'
127
+ isreal = false
128
+ }
129
+ if(selectedOption.value == 'ar'){
130
+ url = 'https://flask-hello-world-murex-sigma.vercel.app/predict'
131
+ isreal = false
132
+ }
133
+ if(selectedOption.value == 'er'){
134
+ url = 'https://flask-hello-world-murex-sigma.vercel.app/pixart'
135
+ isreal = false
136
+ }
137
+ if(selectedOption.value == 'anything'){
138
+ url = 'https://flask-hello-world-murex-sigma.vercel.app/anything'
139
+ prompt = ',masterpiece,HDR,anime,anime style,beuatiful anime'
140
+ fullPrompt = inp.value+prompt
141
+ isreal = false
142
+ }
143
+ if(selectedOption.value == 'focus'){
144
+ url = 'https://flask-hello-world-murex-sigma.vercel.app/focus'
145
+ url2 = 'https://hacking-is-serious-illegal-crime-you.onrender.com/foocus'
146
+ isf = true
147
+ isreal = false
148
+ }
149
+ if(selectedOption.value == 'cas'){
150
+ url = 'https://flask-hello-world-murex-sigma.vercel.app/cascade'
151
+ url2 = 'https://hacking-is-serious-illegal-crime-you.onrender.com/cascade'
152
+ isc = true
153
+ isreal = false
154
+ }
155
+ if(selectedOption.value == 'w'){
156
+ url = 'https://flask-hello-world-murex-sigma.vercel.app/w'
157
+
158
+ isreal = false
159
+ }
160
+ if(selectedOption.value == 'k'){
161
+ url = 'https://flask-hello-world-murex-sigma.vercel.app/k'
162
+
163
+ isreal = false
164
+
165
+ }
166
+ if(selectedOption.value == 'op'){
167
+ url = 'https://flask-hello-world-murex-sigma.vercel.app/op'
168
+
169
+ isreal = false
170
+ }
171
+ if(selectedOption.value == 'p3'){
172
+ url = 'https://flask-hello-world-murex-sigma.vercel.app/p3'
173
+
174
+ isreal = false
175
+ }
176
+ if(selectedOption.value == 'emo'){
177
+ url = 'https://flask-hello-world-murex-sigma.vercel.app/emo'
178
+
179
+ isreal = false
180
+ }
181
+ if(selectedOption.value == 'real'){
182
+ isreal = true
183
+ if(step.value>50){
184
+ step.value = 50
185
+ }
186
+ }
187
+ if(selectedOption.value == 'p4'){
188
+ isreal = false
189
+ isFumes = false
190
+ url = 'https://flask-hello-world-murex-sigma.vercel.app/p4'
191
+
192
+ }
193
+ if(selectedOption.value == 'nut'){
194
+ isreal = false
195
+ isFumes = false
196
+ url = 'https://flask-hello-world-murex-sigma.vercel.app/nut'
197
+
198
+ }
199
+ if(selectedOption.value == 'piss'){
200
+ isreal = false
201
+ isFumes = false
202
+ url = 'https://flask-hello-world-murex-sigma.vercel.app/piss'
203
+
204
+ }
205
+
206
+ }
207
+ let div = document.getElementById('imshow');
208
+
209
+
210
+
211
+
212
+ if(isFumes == true){
213
+
214
+ fullPrompt = inp.value
215
+
216
+ div.innerHTML = '';
217
+ document.getElementById('imshow').innerHTML = ''
218
+ let pi = document.createElement('p')
219
+ pi.innerText = 'Generating Image... Estimated Time: 20s'
220
+ // document.getElementById('imshow').append(pi)
221
+ let chatId = Math.floor(Math.random() * 99999999) + 1;
222
+ let data = {
223
+ prompt: inp.value+prompt
224
+ };
225
+ await fetch('https://l-d83c.onrender.com/generate', {
226
+ method: 'POST',
227
+ headers: {
228
+ 'Content-Type': 'application/json'
229
+ },
230
+ body: JSON.stringify(data)
231
+ })
232
+ .then(response => response.json())
233
+ .then(data =>{
234
+ fullPrompt = data.result
235
+ })
236
+ .catch((error) => {
237
+ console.error('Error:', error);
238
+ });
239
+
240
+
241
+ }
242
+ else{
243
+ fullPrompt = inp.value+prompt
244
+ }
245
+
246
+
247
+ //https://hacking-is-serious-illegal-crime-you.onrender.com/sdxl
248
+
249
+ negative_prompt = nps
250
+ div.innerHTML = '';
251
+ document.getElementById('imshow').innerHTML = ''
252
+ let pi = document.createElement('p')
253
+ pi.innerText = 'Generating Image... Estimated Time: 20s'
254
+ //document.getElementById('imshow').append(pi)
255
+ let count = 0;
256
+ seed = seed
257
+ if(isreal == false){
258
+ let progress = document.createElement('progress');
259
+ progress.value = 1;
260
+ progress.max = 100;
261
+
262
+ div.appendChild(progress);
263
+ setInterval(()=>{
264
+ progress.value+=5
265
+ console.log(progress.value)
266
+
267
+ },1100)
268
+ async function generate(){
269
+
270
+ params={
271
+
272
+ 'prompt': fullPrompt,
273
+ 'negative_prompt': np.value+nps,
274
+ "steps": step.value,
275
+ 'gd': gd.value
276
+ };
277
+
278
+
279
+ try {
280
+ const response = await fetch(url, {
281
+ method: 'POST',
282
+ headers: {
283
+ 'Content-Type': 'application/json',
284
+ 'Connection': 'keep-alive',
285
+ },
286
+ body: JSON.stringify(params)
287
+ });
288
+ if (response.status === 429) {
289
+ pi.innerText = 'you have reached your limit of 50 generation per hour, you will get 50 more image generaions after an hour!!'
290
+ }
291
+ /* console.log(np.value)
292
+ const imgData = await response.text();
293
+ const div = document.getElementById('imshow')
294
+ const img = document.createElement('img');
295
+ pi.innerHTML = ''
296
+ pi.innerText = ''
297
+ img.src = imgData;
298
+ div.appendChild(img);
299
+ */
300
+
301
+ const imgData = await response.text();
302
+ idlist.push(imgData)
303
+
304
+
305
+ } catch (error) {
306
+ btn.disabled = false
307
+ console.error('An error occurred:', error);
308
+ pi.innerText = 'An error occurred, try changing your prompt';
309
+ }
310
+
311
+
312
+ }
313
+
314
+ await Promise.all([generate(),generate()]);
315
+
316
+
317
+ /* function final2(){
318
+ const id = idlist[1].trim().replace(/^"|"$/g, '');
319
+ fetch(url2, {
320
+ method: 'POST',
321
+ headers: {
322
+ 'Content-Type': 'application/json',
323
+ },
324
+ body: JSON.stringify({
325
+ id: id,
326
+ }),
327
+ })
328
+ .then((response) => response.text())
329
+ .then((data) => {
330
+ const img = document.createElement('img');
331
+ pi.innerHTML = ''
332
+ pi.innerText = ''
333
+ img.src = data.trim().replace(/^"|"$/g, '');
334
+ div.appendChild(img);
335
+ btn.disabled = false
336
+ console.log(data)
337
+ })
338
+ .catch((error) =>{
339
+ btn.disabled = false
340
+ console.error('An error occurred:', error);
341
+ pi.innerText = 'An error occurred, try changing your prompt';
342
+ });
343
+ }*/
344
+
345
+ let intervalId = null;
346
+
347
+ function checkProcessStatus(n) {
348
+ console.log(idlist)
349
+ const id = idlist[n].trim().replace(/^"|"$/g, '');
350
+
351
+ fetch(url2, {
352
+ method: 'POST',
353
+ headers: {
354
+ 'Content-Type': 'application/json',
355
+ },
356
+ body: JSON.stringify({
357
+ id: id,
358
+ }),
359
+ })
360
+ .then((response) => response.json())
361
+ .then((data) => {
362
+ if (data.status == 'generating') {
363
+ console.log('in progress');
364
+ // Call the function again after a delay if the status is 'generating'
365
+ setTimeout(() => checkProcessStatus(n), 2000);
366
+ } else {
367
+ cn = false
368
+ progress.innerHTML = ''
369
+ progress.style.display = 'none'
370
+ // Process is complete, handle the data
371
+ console.log(data)
372
+ const img = document.createElement('img');
373
+ pi.innerHTML = '';
374
+ pi.innerText = '';
375
+ img.src = data.trim().replace(/^"|"$/g, '');
376
+ div.appendChild(img);
377
+ btn.disabled = false;
378
+
379
+ }
380
+ })
381
+ .catch((error) => {
382
+ btn.disabled = false;
383
+ console.error('An error occurred:', error);
384
+
385
+ });
386
+ }
387
+
388
+ checkProcessStatus(0);
389
+ checkProcessStatus(1);
390
+
391
+
392
+
393
+ }
394
+
395
+
396
+ }