Spaces:
Running
Running
yasir
commited on
Update index.html
Browse files- index.html +90 -59
index.html
CHANGED
@@ -607,71 +607,104 @@ async function generate(){
|
|
607 |
|
608 |
await Promise.all([generate(), generate()]);
|
609 |
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
.
|
623 |
-
.
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
637 |
}
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
652 |
pi.innerHTML = ''
|
653 |
pi.innerText = ''
|
654 |
-
img.src =
|
655 |
div.appendChild(img);
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
.
|
660 |
-
|
|
|
|
|
|
|
661 |
console.error('An error occurred:', error);
|
662 |
pi.innerText = 'An error occurred, try changing your prompt';
|
663 |
-
}
|
664 |
}
|
665 |
|
666 |
-
|
667 |
-
final1()
|
668 |
-
|
669 |
-
|
670 |
|
671 |
-
|
672 |
-
|
673 |
-
setTimeout(()=>{
|
674 |
-
function final2(){
|
675 |
const id = idlist[1].trim().replace(/^"|"$/g, '');
|
676 |
fetch(url2, {
|
677 |
method: 'POST',
|
@@ -728,14 +761,12 @@ fetch(url2, {
|
|
728 |
|
729 |
final2()
|
730 |
final1()
|
|
|
731 |
|
732 |
|
733 |
|
734 |
-
},3500)
|
735 |
}
|
736 |
|
737 |
-
|
738 |
-
}
|
739 |
</script>
|
740 |
|
741 |
|
|
|
607 |
|
608 |
await Promise.all([generate(), generate()]);
|
609 |
|
610 |
+
isf = false
|
611 |
+
btn.onclick = async ()=>{
|
612 |
+
let url2 = 'https://flask-hello-world-murex-sigma.vercel.app/get_prediction'
|
613 |
+
let idlist = []
|
614 |
+
url = 'https://flask-hello-world-murex-sigma.vercel.app/predict'
|
615 |
+
var selectElement = document.getElementById("model");
|
616 |
+
var selectedIndex = selectElement.selectedIndex;
|
617 |
+
if (selectedIndex === -1) {
|
618 |
+
console.log("No option is selected.");
|
619 |
+
} else {
|
620 |
+
var selectedOption = selectElement.options[selectedIndex];
|
621 |
+
|
622 |
+
if(selectedOption.value == 'rv6'){
|
623 |
+
url = 'https://flask-hello-world-murex-sigma.vercel.app/proteus'
|
624 |
+
|
625 |
+
}
|
626 |
+
if(selectedOption.value == 'ds8'){
|
627 |
+
url = 'https://flask-hello-world-murex-sigma.vercel.app/dream'
|
628 |
+
if(step.value>50){
|
629 |
+
step.value = 50
|
630 |
+
}
|
631 |
+
|
632 |
+
}
|
633 |
+
if(selectedOption.value == 'ra'){
|
634 |
+
url = 'https://flask-hello-world-murex-sigma.vercel.app/playground'
|
635 |
+
|
636 |
+
}
|
637 |
+
if(selectedOption.value == 'ar'){
|
638 |
+
url = 'https://flask-hello-world-murex-sigma.vercel.app/predict'
|
639 |
+
|
640 |
+
}
|
641 |
+
if(selectedOption.value == 'er'){
|
642 |
+
url = 'https://flask-hello-world-murex-sigma.vercel.app/pixart'
|
643 |
+
|
644 |
+
}
|
645 |
+
if(selectedOption.value == 'anything'){
|
646 |
+
url = 'https://flask-hello-world-murex-sigma.vercel.app/anything'
|
647 |
+
|
648 |
+
}
|
649 |
+
if(selectedOption.value == 'focus'){
|
650 |
+
url = 'https://flask-hello-world-murex-sigma.vercel.app/focus'
|
651 |
+
url2 = 'https://flask-hello-world-murex-sigma.vercel.app/foocus'
|
652 |
+
isf = true
|
653 |
+
}
|
654 |
}
|
655 |
+
negative_prompt = nps
|
656 |
+
btn.disabled = true
|
657 |
+
const div = document.getElementById('imshow');
|
658 |
+
div.innerHTML = '';
|
659 |
+
document.getElementById('imshow').innerHTML = ''
|
660 |
+
let pi = document.createElement('p')
|
661 |
+
pi.innerText = 'Generating Image... generation Usually Complete Within 15 seconds'
|
662 |
+
document.getElementById('imshow').append(pi)
|
663 |
+
let count = 0;
|
664 |
+
seed = seed
|
665 |
+
async function generate(){
|
666 |
+
|
667 |
+
const params = {
|
668 |
+
'prompt': inp.value+prompt,
|
669 |
+
'negative_prompt': np.value+nps,
|
670 |
+
"steps": step.value,
|
671 |
+
'gd': gd.value
|
672 |
+
};
|
673 |
+
|
674 |
+
try {
|
675 |
+
const response = await fetch(url, {
|
676 |
+
method: 'POST',
|
677 |
+
headers: {
|
678 |
+
'Content-Type': 'application/json',
|
679 |
+
'Connection': 'keep-alive',
|
680 |
+
},
|
681 |
+
body: JSON.stringify(params)
|
682 |
+
});
|
683 |
+
/* console.log(np.value)
|
684 |
+
const imgData = await response.text();
|
685 |
+
const div = document.getElementById('imshow')
|
686 |
+
const img = document.createElement('img');
|
687 |
pi.innerHTML = ''
|
688 |
pi.innerText = ''
|
689 |
+
img.src = imgData;
|
690 |
div.appendChild(img);
|
691 |
+
*/
|
692 |
+
|
693 |
+
const imgData = await response.text();
|
694 |
+
idlist.push(imgData)
|
695 |
+
|
696 |
+
|
697 |
+
} catch (error) {
|
698 |
+
btn.disabled = false
|
699 |
console.error('An error occurred:', error);
|
700 |
pi.innerText = 'An error occurred, try changing your prompt';
|
701 |
+
}
|
702 |
}
|
703 |
|
704 |
+
await Promise.all([generate(), generate()]);
|
|
|
|
|
|
|
705 |
|
706 |
+
setTimeout(()=>{
|
707 |
+
function final2(){
|
|
|
|
|
708 |
const id = idlist[1].trim().replace(/^"|"$/g, '');
|
709 |
fetch(url2, {
|
710 |
method: 'POST',
|
|
|
761 |
|
762 |
final2()
|
763 |
final1()
|
764 |
+
},21000)
|
765 |
|
766 |
|
767 |
|
|
|
768 |
}
|
769 |
|
|
|
|
|
770 |
</script>
|
771 |
|
772 |
|