Merge branch 'feature/orchestrator-change' of https://bitbucket.org/aarete/doczy.ai into feature/orchestrator-change

This commit is contained in:
Umang Mistry
2024-06-27 16:33:52 -05:00
+29 -33
View File
@@ -75,13 +75,7 @@ except KeyError as e:
try:
conn = get_snowflake_conn('STG')
cur = conn.cursor()
query = 'select * from "TRAINING_DATA_RAW"'
cur.execute(query)
field_values = pd.DataFrame.from_records(iter(cur), columns=[x[0] for x in cur.description])
field_values['Document_Name'] = field_values['DOCUMENT_NAME']
except:
# field_values = pd.read_csv('contract_field_values.csv', encoding='unicode_escape', skipinitialspace=True)
# field_values = field_values.loc[:, ~field_values.columns.str.contains('Unnamed:')]
st.write("Conn failed, unable to fetch data from training data table in Snowflake")
try:
@@ -195,34 +189,36 @@ if client:
elif field_group == 'Timeline':
fields = fields[fields['PRIORITY'] == 'E']
if st.button("Show Results"):
query = 'select * from "DOCZY_PIPELINE_RAW_OUTPUT_AC"'
cur.execute(query)
df2 = pd.DataFrame.from_records(iter(cur), columns=[x[0] for x in cur.description])
button_cols = st.columns([0.2, 0.2, 0.6])
with button_cols[0]:
if st.button("Show Results"):
query = f'select * from "DOCZY_PIPELINE_RAW_OUTPUT_AC" where batch_id = \'{batch_id}\''
cur.execute(query)
df2 = pd.DataFrame.from_records(iter(cur), columns=[x[0] for x in cur.description])
# get this dataframe from snowflake table
# df2 = pd.DataFrame(columns=['Contract Name','Field Name', 'SF_DB_COL_NAME', 'Snippet','Page Number'
# , 'Field Extracted Value', 'Actual Value','Imputed Value'])
df2.to_csv('temp2.csv', index=False)
if st.button("Show PDF"):
if file_name == None or file_name == "All":
st.error("Choose one specific file.")
else:
with st.sidebar:
st.markdown(
"""
<style>
section[data-testid="stSidebar"] {
width: 550px !important; # Set the width to your desired value
}
</style>
""",
unsafe_allow_html=True,
)
s3_obj = s3_client.get_object(Bucket = client_bucket, Key = file_name)
data=s3_obj['Body'].read()
pdf_viewer(data, width=1500)
# get this dataframe from snowflake table
# df2 = pd.DataFrame(columns=['Contract Name','Field Name', 'SF_DB_COL_NAME', 'Snippet','Page Number'
# , 'Field Extracted Value', 'Actual Value','Imputed Value'])
df2.to_csv('temp2.csv', index=False)
with button_cols[1]:
if st.button("Show PDF"):
if file_name == None or file_name == "All":
st.error("Choose one specific file.")
else:
with st.sidebar:
st.markdown(
"""
<style>
section[data-testid="stSidebar"] {
width: 550px !important; # Set the width to your desired value
}
</style>
""",
unsafe_allow_html=True,
)
s3_obj = s3_client.get_object(Bucket = client_bucket, Key = file_name)
data=s3_obj['Body'].read()
pdf_viewer(data, width=1500)
# if st.button("Show PDF"):
# if file_name == None or file_name == "All":