Merged in feature/streamlit_ui1_test (pull request #103)

On page reload Interface 1 resets results to be empty

Approved-by: Priya Iragavarapu
This commit is contained in:
Pratham Soni
2024-06-17 20:57:52 +00:00
committed by Priya Iragavarapu
+13 -1
View File
@@ -31,6 +31,12 @@ st.set_page_config(layout = "wide")
# add_vertical_space(15)
# # st.write("Doczy")
#Update Dataframe to Empty Dataframe When Pipeline is Ran
def update_dataframe():
new_df = pd.DataFrame(columns=['Contract Name', 'Unique Key','Pricing Before Carveouts'
, 'Contract Related', 'Provider', 'Timeline', 'Carveout Indicator', 'Carveout Methodology'])
st.session_state['dataframe'] = new_df
# AARETE LOGO
x,y,z = st.columns([15,2,15])
with y:
@@ -184,7 +190,11 @@ if st.button("Read the contracts from Path"):
add_vertical_space(1)
df2 = pd.read_csv('temp1.csv')
edited_df = st.data_editor(df2)
#Initialize Session State for Dataframe to Reset when Pipeline Run
if 'dataframe' not in st.session_state:
st.session_state['dataframe'] = df2
edited_df = st.data_editor(st.session_state['dataframe'])
edited_df['REQUEST_USER'] = user_mail
edited_df['LATEST_FLAG BOOLEAN'] = True
@@ -254,6 +264,8 @@ with buttons[1]:
if not st.session_state.contract_count == len(edited_df):
st.error("Select at least one Group No. for every Contract")
else:
#Resets the Data Editor with Blank Values
update_dataframe()
with st.spinner('Running...'):
# csv_buf = StringIO()
# additional_info.to_csv(csv_buf, header=True, index=False)