chatbot-model-bills / src /components /render_tab_counts.py
penguinsfly's picture
reorganize into component files, add info, and add pca plot
fd4a87f verified
raw
history blame contribute delete
923 Bytes
import streamlit as st
def render(tab, sim_bill_counts, sim_state_counts, model_bills, sec_counts):
countbar_col1, countbar_col2 = tab.columns([1, 2])
countbar_col1.subheader('Number of bills similar to each model')
countbar_col1.bar_chart(
data=sim_bill_counts,
horizontal=True,
x='model',
y='count'
)
countbar_col2.subheader('Number of states these bills come from')
countbar_col2.bar_chart(
data=sim_state_counts,
x='state',
y='count',
color='model',
stack=False
)
for model, col_modsec in zip(
model_bills, tab.columns([1] * len(model_bills))
):
col_modsec.subheader(f'Sections of {model}')
col_modsec.bar_chart(
data=sec_counts.query('model == @model').reset_index(drop=True),
horizontal=True,
x='section',
y='count'
)