chatbot-model-bills / src /components /render_tab_tables.py
penguinsfly's picture
reorganize into component files, add info, and add pca plot
fd4a87f verified
import streamlit as st
def render(tab, disp_sim_df, multi_model_bills):
dispdfs_col1, dispdfs_col2 = tab.columns([1.5, 1])
dispdfs_col1.subheader('Models & similar bills')
dispdfs_col1.text(
'Note 1: currently the progress columns appear to have same length, '
'but in reality the number of versions are different per bill. '
'I have not figured out how to make them different in Streamlit yet, if even possible.'
)
dispdfs_col1.text(
'Note 2: Select one of the bill-model pair and switch to "Inspect" tab to view sentences.'
)
dispdfs_col1.dataframe(
data=disp_sim_df,
column_config={
'source_sections': st.column_config.ListColumn(
"model sections",
width="medium",
),
"progress_pct_src_sim": st.column_config.AreaChartColumn(
"progess",
y_min=0, y_max=100
),
"url": st.column_config.LinkColumn(display_text = '[Legiscan]'),
},
column_order=[
'model',
'bill',
'version',
'% similar',
'# sentences',
'progress_pct_src_sim',
'source_sections',
'url',
],
selection_mode='single-row-required',
key='bill_model_pair',
on_select="rerun",
)
dispdfs_col2.subheader('Bills similar to more than 1 model')
dispdfs_col2.dataframe(
data=multi_model_bills,
column_config={
'model_pct_sim': st.column_config.ListColumn(
'models & % similarity',
width="medium",
),
"url": st.column_config.LinkColumn(display_text = '[Legiscan]'),
},
)