Spaces:
Runtime error
Runtime error
"""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 json | |
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"]]): | |
xl1 = None | |
xl2 = None | |
else: | |
i = 0 | |
choices = [] | |
st.write("First excel file") | |
for t1 in df1.iterrows(): | |
r1 = t1[1] | |
kps1 = json.loads(r1["Matched KPs"].replace("'", '"')) | |
curr_keys = list(kps1.keys()).copy() | |
for kp1 in curr_keys: | |
if kps1[kp1] > 0.99: | |
kps1.pop(kp1) | |
#now display the kps | |
if kps1 == {}: | |
continue | |
else: | |
for kp1 in kps1.keys(): | |
col1, col2, col3 = st.columns(3) | |
with col1: | |
st.write(r1["KP"]) | |
with col2: | |
st.write(f"kp: {kp1}\ndistance: {kps1[kp1]}") | |
with col3: | |
choices.append(st.radio("Appropriate?", [True, False],key = i)) | |
i+=1 | |