georad commited on
Commit
7af62ce
·
verified ·
1 Parent(s): 27950ba

Update pages/type_text.py

Browse files
Files changed (1) hide show
  1. pages/type_text.py +30 -5
pages/type_text.py CHANGED
@@ -221,11 +221,36 @@ if INTdesc_input is not None and st.button("Map to SBS codes", key="run_st_model
221
  dfALL = pd.concat([dfALL, pd.DataFrame([dictA])], ignore_index=True)
222
 
223
  st.dataframe(data=dfALL, hide_index=True)
224
- # Call the scroll function after displaying results
225
- scroll_to_results()
226
- # Add a small spacer to ensure there's room below the results
227
- # (this helps prevent the last bit of content from being hidden by the status bar)
228
- st.markdown("<div style='height: 60px;'></div>", unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
229
 
230
  display_format = "ask REASONING MODEL: Which, if any, of the following SBS descriptions corresponds best to " + INTdesc_input +"? "
231
  #st.write(display_format)
 
221
  dfALL = pd.concat([dfALL, pd.DataFrame([dictA])], ignore_index=True)
222
 
223
  st.dataframe(data=dfALL, hide_index=True)
224
+ st.markdown("""
225
+ <div id="scroll-target" style="position: relative; bottom: 60px;"></div>
226
+ <script>
227
+ // Function that handles scrolling with an offset
228
+ function scrollWithOffset() {
229
+ // Find our target element
230
+ const target = document.getElementById('scroll-target');
231
+ if (!target) return;
232
+
233
+ // Get the main Streamlit container (parent document since Streamlit uses iframes)
234
+ const streamlitDoc = window.parent.document;
235
+ const mainContainer = streamlitDoc.querySelector('.main');
236
+
237
+ if (mainContainer) {
238
+ // Calculate position that accounts for the status bar
239
+ const scrollPosition = Math.max(0, mainContainer.scrollHeight - window.innerHeight + 60);
240
+
241
+ // Scroll the container
242
+ mainContainer.scrollTop = scrollPosition;
243
+ // Also try the window for good measure
244
+ window.parent.scrollTo(0, scrollPosition);
245
+ }
246
+ }
247
+
248
+ // Try scrolling after small delays to ensure everything is rendered
249
+ setTimeout(scrollWithOffset, 100);
250
+ setTimeout(scrollWithOffset, 300);
251
+ setTimeout(scrollWithOffset, 500);
252
+ </script>
253
+ """, unsafe_allow_html=True)
254
 
255
  display_format = "ask REASONING MODEL: Which, if any, of the following SBS descriptions corresponds best to " + INTdesc_input +"? "
256
  #st.write(display_format)