kcelia commited on
Commit
4c6c1ca
1 Parent(s): 014dfbe

chore: another attemp

Browse files
Files changed (1) hide show
  1. app.py +23 -15
app.py CHANGED
@@ -536,20 +536,28 @@ CSS = """
536
  </button>
537
 
538
  """
539
- back_to_top_btn_html = """
540
- <button id="toTopBtn" onclick="scrollToTop()">
541
- <a style="color:white; text-decoration:none;">Back to Top!</a>
542
- </button>
543
-
544
- <script>
545
- function scrollToTop() {
546
- var element = document.getElementById('toTopBtn');
547
- element.scrollIntoView({ behavior: 'smooth', block: 'start' });
548
- }
549
- </script>
550
-
551
-
552
- """
 
 
 
 
 
 
 
 
553
 
554
  if __name__ == "__main__":
555
 
@@ -559,7 +567,7 @@ if __name__ == "__main__":
559
 
560
  (X_train, X_test), (y_train, y_test), valid_symptoms, diseases = load_data()
561
 
562
- with gr.Blocks(css=CSS) as demo:
563
  gr.HTML(back_to_top_btn_html)
564
 
565
  # Link + images
 
536
  </button>
537
 
538
  """
539
+ back_to_top_btn_html = '''
540
+ <button id="toTopBtn" onclick="'parentIFrame' in window ? window.parentIFrame.scrollTo({top: 0, behavior:'smooth'}) : window.scrollTo({ top: 0 })">
541
+ <a style="color:white; text-decoration:none;">Back to Top!</a>
542
+ </button>'''
543
+
544
+ style="""
545
+ #toTopBtn {
546
+ position: fixed;
547
+ bottom: 10px;
548
+ float: right;
549
+ right: 18.5%;
550
+ left: 77.25%;
551
+ height: 30px;
552
+ max-width: 100px;
553
+ width: 100%;
554
+ font-size: 12px;
555
+ border-color: rgba(217,24,120, .5);
556
+ background-color: rgba(35,153,249,.5);
557
+ padding: .5px;
558
+ border-radius: 4px;
559
+ }
560
+ """
561
 
562
  if __name__ == "__main__":
563
 
 
567
 
568
  (X_train, X_test), (y_train, y_test), valid_symptoms, diseases = load_data()
569
 
570
+ with gr.Blocks(css=style) as demo:
571
  gr.HTML(back_to_top_btn_html)
572
 
573
  # Link + images