File size: 923 Bytes
c26c770 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
import ast
import glob
import os
import pandas as pd
import streamlit as st
FILE_MAP = {
"Tag Scores": "data/tag_summary_group",
"Context Level Scores": "data/context_summary_group"
}
def format_df(df):
cols = []
for col in df.columns:
if col in ["family", "model", "tag"]:
continue
cols.append(col)
formatted_df = df.style.format({col: "{:.1f}" for col in cols})
return formatted_df
# Streamlit app
def main():
st.title("Interface")
selected = st.selectbox("Select a results data:", list(FILE_MAP.keys()))
files = sorted(glob.glob(os.path.join(FILE_MAP[selected], "*.csv")))
for df_file in files:
header_name = os.path.basename(df_file).split(".csv")[0]
st.markdown(f"## {header_name}")
df = format_df(pd.read_csv(df_file))
st.table(df)
if __name__ == "__main__":
main()
|