"""The following program will read in 2 XL sheets of KP matches and the user will evaluate the quality of the matching""" import streamlit as st import pandas as pd xl1 = st.file_uploader("Choose first file", key="xl1") xl2 = st.file_uploader("Choose second file", key="xl2") if xl1 is not None and xl2 is not None: #assert that the first few columns are the same df1 = pd.read_excel(xl1, sheet_name= "0.85 Threshold") df2 = pd.read_excel(xl2, sheet_name= "0.85 Threshold") st.write(df1[["Attendee A","Attendee B","KP"]]) if not df1[["Attendee A","Attendee B","KP"]].equals(df2[["Attendee A","Attendee B","KP"]]): st.write("The files' attendees and KPs don't match!") xl1 = None xl2 = None else: for t1,t2 in zip(df1.iterrows(),df2.iterrows()): r1 = t1[1] r2 = t2[1] assert r1["KP"] == r2["KP"] kps1 = r1["Matched KPs"] kps2 = r2["Matched KPs"] for kp1, kp2 in zip(kps1.keys(),kps2.keys()): if kps1[kp1] > 0.99: kps1.pop(kp1) if kps2[kp2] > 0.99: kps2.pop(kp2) #now display the kps if kps1 == {} and kps2 == {}: continue if kps1 != {}: for kp1 in kps1.keys(): with st.container(): col1, col2, col3 = st.columns() with col1: st.write(r1["KP"] with col2: st.write(f"kp: {kp1} , distance: {kps1[kp1]}") with col3: st.radio("Appropriate?", [True, False])