Skip to content

Commit

Permalink
Merge branch 'main' into streamlit_issue_59
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyfix committed Apr 24, 2024
2 parents 5537660 + c54cb22 commit e6df58c
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 19 deletions.
2 changes: 2 additions & 0 deletions app/pages/0_Import_File.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

st.markdown("# Configuration")

st.markdown("## PDF Report to process")
original_pdf = st.file_uploader(
"Upload a pdf document containing financial table : ",
)
Expand All @@ -39,6 +40,7 @@
"Already loaded file : " + st.session_state["original_pdf_name"],
)

st.markdown("## Pipeline configuration")
loaded_config = st.file_uploader(
"Upload a config if the default config doesn't suit you :",
)
Expand Down
27 changes: 22 additions & 5 deletions app/pages/3_Merge_Tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ def save_merge(table_extractor: str) -> None:
st.session_state["algorithm_name"] = table_extractor


def remove_table(key: str) -> None:
del st.session_state["tables"][key]
if (
"algorithm_name" in st.session_state
and st.session_state["algorithm_name"] == key
):
del st.session_state["algorithm_name"]


st.set_page_config(layout="wide", page_title="Merge Tables") # page_icon="📈"
st.title("Country by Country Tax Reporting analysis : Headers")
st.subheader(
Expand Down Expand Up @@ -88,11 +97,19 @@ def save_merge(table_extractor: str) -> None:
if table_extractor is not None:
for key, table in st.session_state["tables"].items():
if table_extractor in key:
st.markdown("Table shape :" + str(table.shape))
st.markdown("Table name : " + key)
st.dataframe(
table,
)
with st.container(border=True):
st.markdown("Table shape :" + str(table.shape))
st.markdown("Table name : " + key)
st.dataframe(
table,
)
st.button(
"Remove this table",
type="primary",
on_click=remove_table,
args=(key,),
key=key,
)

with col2:
st.markdown(
Expand Down
16 changes: 9 additions & 7 deletions app/pages/4_Clean_Headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,18 @@ def set_headers(algorithm_name: str) -> None:
unsafe_allow_html=True,
)
with col2:
index = (
list(st.session_state.tables.keys()).index(
st.session_state["algorithm_name"],
)
if "algorithm_name" in st.session_state
else 0
)

st.session_state["algorithm_name"] = st.selectbox(
"Choose the extracted table you want to see",
list(st.session_state.tables.keys()),
index=(
list(st.session_state.tables.keys()).index(
st.session_state["algorithm_name"],
)
if "algorithm_name" in st.session_state
else 0
),
index=index,
on_change=set_algorithm_name,
args=("selectbox1",),
key="selectbox1",
Expand Down
16 changes: 9 additions & 7 deletions app/pages/5_Clean_Tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,18 @@ def update_df_csv_to_save() -> None:
)

with col4:
index = (
list(st.session_state.tables.keys()).index(
st.session_state["algorithm_name"],
)
if "algorithm_name" in st.session_state
else 0
)

st.session_state["algorithm_name"] = st.selectbox(
"Choose the extracted table you want to see",
list(st.session_state.tables.keys()),
index=(
list(st.session_state.tables.keys()).index(
st.session_state["algorithm_name"],
)
if "algorithm_name" in st.session_state
else 0
),
index=index,
on_change=set_algorithm_name,
args=("selectbox2",),
key="selectbox2",
Expand Down

0 comments on commit e6df58c

Please sign in to comment.