yasir commited on
Commit
a1c7ff2
·
verified ·
1 Parent(s): 23e4e20

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +68 -2
index.html CHANGED
@@ -499,6 +499,7 @@ let nps = ' ,deformed fingers,mutated hands,unrealistic hands,extra fingers,less
499
  }
500
  }
501
 
 
502
  btn.onclick = async ()=>{
503
  let url2 = 'https://api-cmgn.onrender.com/get_prediction'
504
  let idlist = []
@@ -539,7 +540,8 @@ if (selectedIndex === -1) {
539
  }
540
  if(selectedOption.value == 'focus'){
541
  url = 'https://flask-hello-world-murex-sigma.vercel.app/focus'
542
- url2 = 'https://api-cmgn.onrender.com/foocus'
 
543
  }
544
  }
545
  negative_prompt = nps
@@ -593,7 +595,8 @@ async function generate(){
593
 
594
  await Promise.all([generate(), generate()]);
595
 
596
- function final2(){
 
597
  const id = idlist[1].trim().replace(/^"|"$/g, '');
598
  fetch(url2, {
599
  method: 'POST',
@@ -651,6 +654,69 @@ fetch(url2, {
651
  final2()
652
  final1()
653
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
654
 
655
 
656
  }
 
499
  }
500
  }
501
 
502
+ isf = false
503
  btn.onclick = async ()=>{
504
  let url2 = 'https://api-cmgn.onrender.com/get_prediction'
505
  let idlist = []
 
540
  }
541
  if(selectedOption.value == 'focus'){
542
  url = 'https://flask-hello-world-murex-sigma.vercel.app/focus'
543
+ url2 = 'https://flask-hello-world-murex-sigma.vercel.app/foocus'
544
+ isf = true
545
  }
546
  }
547
  negative_prompt = nps
 
595
 
596
  await Promise.all([generate(), generate()]);
597
 
598
+ if(isf==false){
599
+ function final2(){
600
  const id = idlist[1].trim().replace(/^"|"$/g, '');
601
  fetch(url2, {
602
  method: 'POST',
 
654
  final2()
655
  final1()
656
 
657
+ }
658
+ else{
659
+ setTimeout(()=>{
660
+ function final2(){
661
+ const id = idlist[1].trim().replace(/^"|"$/g, '');
662
+ fetch(url2, {
663
+ method: 'POST',
664
+ headers: {
665
+ 'Content-Type': 'application/json',
666
+ },
667
+ body: JSON.stringify({
668
+ id: id,
669
+ }),
670
+ })
671
+ .then((response) => response.text())
672
+ .then((data) => {
673
+ const img = document.createElement('img');
674
+ pi.innerHTML = ''
675
+ pi.innerText = ''
676
+ img.src = data.trim().replace(/^"|"$/g, '');
677
+ div.appendChild(img);
678
+ btn.disabled = false
679
+ console.log(data)
680
+ })
681
+ .catch((error) =>{
682
+ btn.disabled = false
683
+ console.error('An error occurred:', error);
684
+ pi.innerText = 'An error occurred, try changing your prompt';
685
+ });
686
+ }
687
+ function final1(){
688
+ const id = idlist[0].trim().replace(/^"|"$/g, '');
689
+ fetch(url2, {
690
+ method: 'POST',
691
+ headers: {
692
+ 'Content-Type': 'application/json',
693
+ },
694
+ body: JSON.stringify({
695
+ id: id,
696
+ }),
697
+ })
698
+ .then((response) => response.text())
699
+ .then((data) => {
700
+ const img = document.createElement('img');
701
+ pi.innerHTML = ''
702
+ pi.innerText = ''
703
+ img.src = data.trim().replace(/^"|"$/g, '');
704
+ div.appendChild(img);
705
+ btn.disabled = false
706
+ console.log(data)
707
+ })
708
+ .catch((error) => {
709
+ btn.disabled = false
710
+ console.error('An error occurred:', error);
711
+ pi.innerText = 'An error occurred, try changing your prompt';
712
+ });
713
+ }
714
+
715
+ final2()
716
+ final1()
717
+
718
+ },15000)
719
+ }
720
 
721
 
722
  }