georad commited on
Commit
8721823
·
verified ·
1 Parent(s): 60601c1

Update pages/home.py

Browse files
Files changed (1) hide show
  1. pages/home.py +14 -31
pages/home.py CHANGED
@@ -49,37 +49,20 @@ st.header("Tags the below 41 medical entities")
49
  'WEIGHT'
50
 
51
 
52
- # Generate the content
53
- content_lines = [f"This is scrollable content line {i}" for i in range(100)]
54
- content_html = "<br>".join(content_lines)
55
 
56
- # Create HTML with auto-scroll functionality
57
- html_content = f"""
58
- <!DOCTYPE html>
59
- <html>
60
- <head>
61
- <style>
62
- body {{
63
- font-family: sans-serif;
64
- padding: 10px;
65
- }}
66
- </style>
67
- </head>
68
- <body>
69
- {content_html}
70
- <script>
71
- // Auto-scroll to bottom when loaded
72
- window.onload = function() {{
73
- window.scrollTo(0, document.body.scrollHeight);
74
- }};
75
- </script>
76
- </body>
77
- </html>
78
- """
79
 
80
- # Display the content in an iframe (this isolates the JavaScript execution)
81
- st.components.v1.html(html_content, height=400, scrolling=True)
82
 
83
- # Add a button that refreshes the page (useful if the auto-scroll doesn't work)
84
- if st.button("Scroll to Bottom"):
85
- pass # This will cause the page to refresh
 
 
 
 
49
  'WEIGHT'
50
 
51
 
52
+ # This is the key trick:
53
+ # 1. Define all content first
54
+ content = [f"This is scrollable content line {i}" for i in range(100)]
55
 
56
+ # 2. Display first part of content
57
+ for i in range(len(content) - 1):
58
+ st.write(content[i])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
+ # 3. Add a placeholder for the last item
61
+ last_item = st.empty()
62
 
63
+ # 4. Show "Bottom Reached!" message to confirm we're at the bottom
64
+ st.success("Bottom of page reached!")
65
+
66
+ # 5. Finally, add the last content item
67
+ # This forces Streamlit to render the page up to the bottom
68
+ last_item.write(content[-1])