Spaces:
Running
Running
Yoad
commited on
Commit
·
68eb1ef
1
Parent(s):
3a71be4
Cache CSV reading
Browse filesImprove sidebar layout
- src/app.py +10 -4
src/app.py
CHANGED
@@ -86,6 +86,12 @@ def choose_input_file_from_leaderboard():
|
|
86 |
st.rerun()
|
87 |
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
def display_rtl(html):
|
90 |
"""Render an RTL container with the provided HTML string"""
|
91 |
st.markdown(
|
@@ -277,7 +283,7 @@ def main():
|
|
277 |
uploaded_file = st.session_state.results_file
|
278 |
# Load the data
|
279 |
try:
|
280 |
-
eval_results =
|
281 |
st.success("File uploaded successfully!")
|
282 |
|
283 |
with st.sidebar:
|
@@ -299,6 +305,9 @@ def main():
|
|
299 |
}
|
300 |
)
|
301 |
|
|
|
|
|
|
|
302 |
# Create sidebar for entry selection
|
303 |
st.sidebar.header("Select Entry")
|
304 |
|
@@ -348,9 +357,6 @@ def main():
|
|
348 |
# Use the selected entry
|
349 |
selected_entry = st.session_state.selected_entry_idx
|
350 |
|
351 |
-
# Toggle for normalized vs raw text
|
352 |
-
use_normalized = st.sidebar.toggle("Use normalized text", value=True)
|
353 |
-
|
354 |
# Get the text columns based on the toggle
|
355 |
if use_normalized and "norm_reference_text" in eval_results.columns:
|
356 |
ref_col, hyp_col = "norm_reference_text", "norm_predicted_text"
|
|
|
86 |
st.rerun()
|
87 |
|
88 |
|
89 |
+
@st.cache_data
|
90 |
+
def read_results_csv(uploaded_file):
|
91 |
+
with st.spinner("Loading results...", show_time=True):
|
92 |
+
return pd.read_csv(uploaded_file)
|
93 |
+
|
94 |
+
|
95 |
def display_rtl(html):
|
96 |
"""Render an RTL container with the provided HTML string"""
|
97 |
st.markdown(
|
|
|
283 |
uploaded_file = st.session_state.results_file
|
284 |
# Load the data
|
285 |
try:
|
286 |
+
eval_results = read_results_csv(uploaded_file)
|
287 |
st.success("File uploaded successfully!")
|
288 |
|
289 |
with st.sidebar:
|
|
|
305 |
}
|
306 |
)
|
307 |
|
308 |
+
# Toggle for normalized vs raw text
|
309 |
+
use_normalized = st.sidebar.toggle("Use normalized text", value=True)
|
310 |
+
|
311 |
# Create sidebar for entry selection
|
312 |
st.sidebar.header("Select Entry")
|
313 |
|
|
|
357 |
# Use the selected entry
|
358 |
selected_entry = st.session_state.selected_entry_idx
|
359 |
|
|
|
|
|
|
|
360 |
# Get the text columns based on the toggle
|
361 |
if use_normalized and "norm_reference_text" in eval_results.columns:
|
362 |
ref_col, hyp_col = "norm_reference_text", "norm_predicted_text"
|