run doczy pipeline button

This commit is contained in:
Mayank Aamseek
2024-03-18 13:22:38 +05:30
parent b0283c8d55
commit d60e8e0684
+46 -2
View File
@@ -7,10 +7,13 @@ from io import StringIO
from datetime import datetime
import boto3
import util
import requests
doczy_pipeline = 'https://8ir4vi1ri4.execute-api.us-east-2.amazonaws.com/dev/'
REDIRECT_URI = 'https://doczy.aarete.com:8501'
user_list = ['maamseek@aarete.com', 'smahdavian@aarete.com', 'ahinge@aarete.com', 'akadam@aarete.com'
, 'piragavarapu@aarete.com', 'umistry@aarete.com']
, 'piragavarapu@aarete.com', 'umistry@aarete.com', 'pkatariya@aarete.com']
st.set_page_config(layout = "wide")
# # Sidebar contents
# with st.sidebar:
@@ -130,11 +133,52 @@ if user_mail in user_list:
csv = convert_df(edited_df)
edited_df = edited_df.reset_index() # make sure indexes pair with number of rows
contract_list = []
for index, row in edited_df.iterrows():
group_list = []
if row['Unique Key']:
group_list.append('Unique Key')
if row['Pricing Before Carveouts']:
group_list.append('Pricing Before Carveouts')
if row['Contract Related']:
group_list.append('Contract Related')
if row['Provider']:
group_list.append('Provider')
if row['Timeline']:
group_list.append('Timeline')
if row['Carveout Indicator']:
group_list.append('Carveout Indicator')
if row['Carveout Methodology']:
group_list.append('Carveout Methodology')
entry_dict = {
"contract_name": row['Contract Name'],
"groups": group_list,
"contract_source_path": "batches/batch_1/"+client+"/"+row['Contract Name']
}
contract_list.append(entry_dict)
myobj = {
"s3_bucket": 'doczy-dev-infra-textract',
"batch_id": 1,
"client_name": client,
"username": user_mail,
"contract_list": contract_list,
"contract_source_path": "batches/batch_1/"+client+"/"
}
buttons = st.columns([0.8, 0.2])
with buttons[0]:
st.download_button("Download Table", csv, "file.csv", "text/csv", key='download-csv')
with buttons[1]:
st.button("Run Doczy.AI Pipeline")
if st.button("Run Doczy.AI Pipeline"):
x = requests.post(doczy_pipeline, json = myobj)
a = x.text
# st.write(a)
else:
st.write("Access Denied")