Spaces:
Running
Running
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +31 -26
src/streamlit_app.py
CHANGED
|
@@ -100,32 +100,37 @@ if selected_tier == 'F1':
|
|
| 100 |
html += "</table>"
|
| 101 |
st.markdown(html, unsafe_allow_html=True)
|
| 102 |
else:
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
#
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
#
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
#
|
| 112 |
-
|
| 113 |
-
#
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
|
| 130 |
|
| 131 |
|
|
|
|
| 100 |
html += "</table>"
|
| 101 |
st.markdown(html, unsafe_allow_html=True)
|
| 102 |
else:
|
| 103 |
+
df = load_data("src/model_acc.json")
|
| 104 |
+
|
| 105 |
+
# Precompute max ranks for color scaling
|
| 106 |
+
score_cols = [f"T{i}" for i in range(1, 12)] + ["Avg"]
|
| 107 |
+
max_ranks = {col: df[f"{col}_rank"].max() for col in score_cols}
|
| 108 |
+
# Build raw HTML table
|
| 109 |
+
cols = ["Model"] + [f"T{i}" for i in range(1,12)] + ["Avg"]
|
| 110 |
+
html = "<table style='border-collapse:collapse; width:100%; font-size:14px;'>"
|
| 111 |
+
# header
|
| 112 |
+
html += "<tr>" + "".join(f"<th style='padding:6px;'>{col}</th>" for col in cols) + "</tr>"
|
| 113 |
+
# rows
|
| 114 |
+
for _, row in df.iterrows():
|
| 115 |
+
html += "<tr>"
|
| 116 |
+
for col in cols:
|
| 117 |
+
val = row[col]
|
| 118 |
+
if col == "Model":
|
| 119 |
+
html += f"<td style='padding:6px; text-align:left;'>{val}</td>"
|
| 120 |
+
else:
|
| 121 |
+
rank = int(row[f"{col}_rank"])
|
| 122 |
+
norm = 1 - (rank - 1) / ((max_ranks[col] - 1) or 1)
|
| 123 |
+
# interpolate green (182,243,182) → white (255,255,255)
|
| 124 |
+
r = int(255 - norm*(255-182))
|
| 125 |
+
g = int(255 - norm*(255-243))
|
| 126 |
+
b = 255
|
| 127 |
+
bold = "font-weight:bold;" if rank == 1 else ""
|
| 128 |
+
style = f"background-color:rgb({r},{g},{b}); padding:6px; {bold}"
|
| 129 |
+
html += f"<td style='{style}'>{val}</td>"
|
| 130 |
+
html += "</tr>"
|
| 131 |
+
html += "</table>"
|
| 132 |
+
st.markdown(html, unsafe_allow_html=True)
|
| 133 |
+
|
| 134 |
|
| 135 |
|
| 136 |
|