import streamlit as st from langchain_pipeline import pipeline, model_names st.title("Canarie AI Prototype") st.subheader("Finding the canarie in the coal mine") model_name = st.selectbox( "Model", model_names()) balance_type = st.selectbox( "Do you charge on available balance or ledger balance?", ["available balance", "ledger balance"] ) apsn_transactions = st.selectbox( "Do you charge for APSN transactions?", ["yes", "no"] ) max_fees_per_day = st.number_input( "How many overdraft fees per day can be charged?", min_value=0, max_value=10, value=3 ) min_overdrawn_fee = st.number_input( "What is the minimum amount overdrawn to incur a fee?", min_value=0, value=50 ) min_transaction_overdraft = st.number_input( "What is the minimum transaction amount to trigger an overdraft?", min_value=0, value=25 ) uploaded_file = st.file_uploader("Choose a file") if uploaded_file is not None: diff = "" with st.spinner('Please wait ...'): try: diff = pipeline( uploaded_file, model_name, balance_type, apsn_transactions, max_fees_per_day, min_overdrawn_fee, min_transaction_overdraft ) ) except Exception as e: st.exception(e) diff_lines = diff.split("\n") styled_diff = """
""" for line in diff_lines: if line.startswith('+'): styled_diff += f'
{line}
' elif line.startswith('-'): styled_diff += f'
{line}
' else: styled_diff += f'
{line}
' styled_diff += "
" st.markdown(styled_diff, unsafe_allow_html=True) st.markdown("The key changes are:")