MisterProton/Stable-Diffusion-Models-Demo
1
1document.getElementById('jd').onclick = ()=>{2 window.open('https://discord.gg/ju4yQBfQ7p')3}4 5 6/*document.getElementById('ow').onclick = ()=>{7 window.open('https://www.buymeacoffee.com/mygx')8}*/9document.getElementById('fumes').checked = true10let dialog = document.getElementById('dialog')11let openbtn = document.getElementById('Advance Setting')12let closebtn = document.getElementById('close')13openbtn.onclick = ()=>{14 dialog.show()15 document.getElementById('imshow').style.border = '0px solid black transparent'16}17closebtn.onclick= ()=>{18 dialog.close()19 document.getElementById('imshow').style.background = 'linear-gradient(black, black) padding-box,linear-gradient(to right, red, blue) border-box' 20}21let inp = document.getElementById('inp')22let np = document.getElementById('np')23let gd = document.getElementById('gds')24let step = document.getElementById('step')25let seed = document.getElementById('seed')26let seedp = document.getElementById('seedp')27let stepp = document.getElementById('stepp')28let gdsp = document.getElementById('gdsp')29let btn = document.getElementById('create')30gd.addEventListener('input',()=>{31 gdsp.innerText = gd.value32})33step.addEventListener('input',()=>{34 stepp.innerText = step.value35})36seed.addEventListener('input',()=>{37 seedp.innerText = seed.value38})39isFumes = true40let prompt = ',RAW photo, photorealistic, extremely detailed informations, hyper:realistic,HIGHLY INTRICATE DETAILS,EXTREMELY MASTERPIECE'41let 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'42document.getElementById('styles').onchange = ()=>{43 const selectedStyle = document.querySelector('input[name="style"]:checked');44 if(selectedStyle.value =='photo'){45 isFumes = true46 prompt = ' ,RAW photo, portrait photo,(high detailed skin:1. 2), 8k uhd, dslr, soft lighting, high quality, film grain, Fujifilm'47 nps = ' ,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'48 }49 if(selectedStyle.value == 'cinema'){50 isFumes = true51 prompt = ' ,cinematic film still awardwinning photo, highly detailed, high budget, bokeh, cinemascope, moody, epic, gorgeous, film grain, grainy'52 nps = ' ,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'53 }54 if(selectedStyle.value == 'real'){55 isFumes = true56 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'57 nps = ' ,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'58 }59 if(selectedStyle.value == 'fantasy'){60 isFumes = true61 prompt = ' ,centered shot, wide angle, full body, dd, fantasy, highly detailed, digital painting, artstation, smooth, sharp focus, digital art'62 nps = ' ,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'63 }64 if(selectedStyle.value == 'anime'){65 isFumes = true66 prompt = ' ,masterpiece,HDR,anime,anime style,beuatiful anime'67 nps = ' ,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'68 }69 if(selectedStyle.value == 'fumes'){70 isFumes = true71 let prompt = ' ,RAW photo,dynamic lights, photorealistic, extremely detailed informations, dynamic colors,realistic,SciFi,award winning photography,film grain,beautiful,attarctive'72let nps = ' ,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'73 }74 if(selectedStyle.value == 'no'){75 prompt = ''76 nps = ''77 isFumes = false78 }79}80 81isf = false82 83reload = false84let fullPrompt = inp.value+prompt85setTimeout(()=>{86 reload = true87},200000)88btn.onclick = async ()=>{ 89 let isc = false90 let id = ''91 if(reload == true){92 window.location.reload();93 }94 if(isFumes == 'no'){95 fullPrompt = inp.value96 const div = document.getElementById('imshow');97 div.innerHTML = '';98 document.getElementById('imshow').innerHTML = ''99 let pi = document.createElement('p')100 pi.innerText = 'Generating Image... Estimated Time: 20s'101 document.getElementById('imshow').append(pi)102 let chatId = Math.floor(Math.random() * 99999999) + 1;103 let data = {104 prompt: inp.value+prompt105};106await fetch('https://flask-hello-world-murex-sigma.vercel.app/generate', {107method: 'POST',108headers: {109 'Content-Type': 'application/json'110},111body: JSON.stringify(data)112})113.then(response => response.json())114.then(data =>{115id = data116})117.catch((error) => {118console.error('Error:', error);119});120 121 122 }123 else{124 fullPrompt = inp.value+prompt125 }126 127 128//https://hacking-is-serious-illegal-crime-you.onrender.com/sdxl129let url2 = 'https://hacking-is-serious-illegal-crime-you.onrender.com/get_prediction'130let idlist = []131 url = 'https://flask-hello-world-murex-sigma.vercel.app/predict'132var selectElement = document.getElementById("model");133var selectedIndex = selectElement.selectedIndex;134if (selectedIndex === -1) {135 console.log("No option is selected.");136} else {137 var selectedOption = selectElement.options[selectedIndex];138 139 if(selectedOption.value == 'rv6'){140 url = 'https://flask-hello-world-murex-sigma.vercel.app/proteus'141 142 }143 if(selectedOption.value == 'ds8'){144 url = 'https://flask-hello-world-murex-sigma.vercel.app/dream'145 if(step.value>50){146 step.value = 50147 }148 149 }150 if(selectedOption.value == 'ra'){151 url = 'https://flask-hello-world-murex-sigma.vercel.app/playground'152 153 }154 if(selectedOption.value == 'ar'){155 url = 'https://flask-hello-world-murex-sigma.vercel.app/predict'156 157 }158 if(selectedOption.value == 'er'){159 url = 'https://flask-hello-world-murex-sigma.vercel.app/pixart'160 161 }162 if(selectedOption.value == 'anything'){163 url = 'https://flask-hello-world-murex-sigma.vercel.app/anything'164 prompt = ',masterpiece,HDR,anime,anime style,beuatiful anime'165 fullPrompt = inp.value+prompt166 }167 if(selectedOption.value == 'focus'){168 url = 'https://flask-hello-world-murex-sigma.vercel.app/focus'169 url2 = 'https://hacking-is-serious-illegal-crime-you.onrender.com/foocus'170 isf = true171 }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 = true176 }177}178negative_prompt = nps179btn.disabled = true180const div = document.getElementById('imshow');181div.innerHTML = '';182document.getElementById('imshow').innerHTML = ''183let pi = document.createElement('p')184pi.innerText = 'Generating Image... Estimated Time: 20s'185document.getElementById('imshow').append(pi)186let count = 0;187seed = seed188async function generate(){189 params={190 191 'prompt': fullPrompt,192 'negative_prompt': np.value+nps,193 "steps": step.value,194 'gd': gd.value195 };196 197 198 try {199 const response = await fetch(url, {200 method: 'POST',201 headers: {202 'Content-Type': 'application/json',203 'Connection': 'keep-alive',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')213 const img = document.createElement('img');214 pi.innerHTML = ''215 pi.innerText = ''216 img.src = imgData;217 div.appendChild(img);218 */219 220 const imgData = await response.text(); 221 idlist.push(imgData)222 223 224 } catch (error) {225 btn.disabled = false226 console.error('An error occurred:', error);227 pi.innerText = 'An error occurred, try changing your prompt';228 }229 230 231}232 233await Promise.all([generate()]);234 235setTimeout(()=>{236 /* function final2(){237 const id = idlist[1].trim().replace(/^"|"$/g, '');238fetch(url2, {239 method: 'POST',240 headers: {241 'Content-Type': 'application/json',242 },243 body: JSON.stringify({244 id: id,245 }),246})247.then((response) => response.text()) 248.then((data) => {249 const img = document.createElement('img');250 pi.innerHTML = ''251 pi.innerText = ''252 img.src = data.trim().replace(/^"|"$/g, '');253 div.appendChild(img);254 btn.disabled = false255 console.log(data)256})257.catch((error) =>{258 btn.disabled = false259 console.error('An error occurred:', error);260 pi.innerText = 'An error occurred, try changing your prompt';261});262}*/263function final1(){264 const id = idlist[0].trim().replace(/^"|"$/g, '');265fetch(url2, {266 method: 'POST',267 headers: {268 'Content-Type': 'application/json',269 },270 body: JSON.stringify({271 id: id,272 }),273})274.then((response) => response.text()) 275.then((data) => {276 const img = document.createElement('img');277 pi.innerHTML = ''278 pi.innerText = ''279 img.src = data.trim().replace(/^"|"$/g, '');280 div.appendChild(img);281 btn.disabled = false282 console.log(data)283})284 285.catch((error) => {286 btn.disabled = false287 console.error('An error occurred:', error);288 pi.innerText = 'An error occurred, try changing your prompt';289});290}291 292 293final1()294},8000)295 296}