annikwag commited on
Commit
3b73ef4
·
verified ·
1 Parent(s): 164983f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -15
app.py CHANGED
@@ -412,21 +412,7 @@ else:
412
  st.session_state.page = 1
413
  current_page = st.session_state.page
414
 
415
- # Top pagination widget (right aligned, 1/7 width)
416
- col_pag_top = st.columns([6, 1])[1]
417
- new_page_top = col_pag_top.selectbox("Select Page", list(range(1, total_pages + 1)), index=current_page - 1, key="page_top_sem")
418
- st.session_state.page = new_page_top
419
-
420
- start_index = (st.session_state.page - 1) * page_size
421
- end_index = start_index + page_size
422
- top_results = filtered_semantic_no_dupe[start_index:end_index]
423
-
424
- # Prominent page info with bold numbers and green highlight if current page is not 1
425
- page_num = f"<b style='color: green;'>{st.session_state.page}</b>" if st.session_state.page != 1 else f"<b>{st.session_state.page}</b>"
426
- total_pages_str = f"<b>{total_pages}</b>"
427
- st.markdown(f"Showing **{len(top_results)}** Semantic Search results (Page {page_num} of {total_pages_str})", unsafe_allow_html=True)
428
-
429
- # --- RAG Answer (Left aligned, fully bold, highlighted in grey) ---
430
  rag_answer = get_rag_answer(var, top_results, DEDICATED_ENDPOINT, WRITE_ACCESS_TOKEN)
431
  bullet_lines = []
432
  for line in rag_answer.splitlines():
@@ -445,7 +431,21 @@ else:
445
  "</ul></div>"
446
  )
447
  st.markdown(formatted_rag_answer, unsafe_allow_html=True)
 
448
  st.divider()
 
 
 
 
 
 
 
 
 
 
 
 
 
449
 
450
  for i, res in enumerate(top_results, start=start_index+1):
451
  metadata = res.payload.get('metadata', {})
 
412
  st.session_state.page = 1
413
  current_page = st.session_state.page
414
 
415
+ # --- RAG Answer (Left aligned, fully bold, highlighted in grey) ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
416
  rag_answer = get_rag_answer(var, top_results, DEDICATED_ENDPOINT, WRITE_ACCESS_TOKEN)
417
  bullet_lines = []
418
  for line in rag_answer.splitlines():
 
431
  "</ul></div>"
432
  )
433
  st.markdown(formatted_rag_answer, unsafe_allow_html=True)
434
+
435
  st.divider()
436
+ # Top pagination widget (right aligned, 1/7 width)
437
+ col_pag_top = st.columns([6, 1])[1]
438
+ new_page_top = col_pag_top.selectbox("Select Page", list(range(1, total_pages + 1)), index=current_page - 1, key="page_top_sem")
439
+ st.session_state.page = new_page_top
440
+
441
+ start_index = (st.session_state.page - 1) * page_size
442
+ end_index = start_index + page_size
443
+ top_results = filtered_semantic_no_dupe[start_index:end_index]
444
+
445
+ # Prominent page info with bold numbers and green highlight if current page is not 1
446
+ page_num = f"<b style='color: green;'>{st.session_state.page}</b>" if st.session_state.page != 1 else f"<b>{st.session_state.page}</b>"
447
+ total_pages_str = f"<b>{total_pages}</b>"
448
+ st.markdown(f"Showing **{len(top_results)}** Semantic Search results (Page {page_num} of {total_pages_str})", unsafe_allow_html=True)
449
 
450
  for i, res in enumerate(top_results, start=start_index+1):
451
  metadata = res.payload.get('metadata', {})