Skip to content

Commit 2f126ee

Browse files
committed
Do away with columns to avoid misalignment
1 parent 2e44fd2 commit 2f126ee

File tree

3 files changed

+18
-35
lines changed

3 files changed

+18
-35
lines changed

.DS_Store

-10 KB
Binary file not shown.

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ chroma_db/
55
*.sqlite3
66
*.pkl
77
*.pyc
8-
*.DS_store
8+
*.DS_Store
99
*.ipynb_checkpoints
1010
*.csv
1111
serving/data/
@@ -16,4 +16,4 @@ tools/data/*
1616
*checkpoint*
1717
*.pid
1818
tools/data/
19-
tools/data/*
19+
tools/data/*

tools/app.py

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -81,48 +81,31 @@ def load_label_data() -> dict[int, list[str]]:
8181

8282

8383
topic_queries = load_csv("data/LLM Evaluation - Topic Queries.csv")
84-
topics = topic_queries['Topic']
85-
print(topics)
86-
87-
title_left, title_right = st.columns(spec=2, gap="medium")
88-
with title_left:
89-
st.write("## Query")
90-
91-
with title_right:
92-
st.write("## Is it relevant?")
93-
84+
topics = topic_queries['Topic'].tolist()
85+
st.write("## For each query, is this dataset relevant?")
9486

9587
def update_relevancy(var, topic):
96-
print(st.session_state[var], topic)
9788
if st.session_state[var] and topic not in st.session_state[UNSAVED_DATA][did]:
9889
st.session_state[UNSAVED_DATA][did].append(topic)
9990
if not st.session_state[var] and topic in st.session_state[UNSAVED_DATA][did]:
10091
st.session_state[UNSAVED_DATA][did].remove(topic)
10192

10293

10394
with st.container(height=400):
104-
query_left, relevant_right = st.columns(spec=2)
105-
106-
with query_left:
107-
for topic in topics:
108-
st.write(topic)
109-
110-
with relevant_right:
111-
for i, topic in enumerate(topics):
112-
def update_this_relevancy(var_, topic_):
113-
"""Helper function to bind the variables to scope."""
114-
return lambda: update_relevancy(f"q{var_}", topic_)
115-
116-
# We need to use the on_change callbacks instead of the regular
117-
# return values, because state needs to be up-to-date *before*
118-
# the next render pass.
119-
st.checkbox(
120-
label=f"q{i}",
121-
label_visibility="hidden",
122-
value=(topic in st.session_state[UNSAVED_DATA][did]),
123-
key=f"q{i}",
124-
on_change=update_this_relevancy(i, topic),
125-
)
95+
for i, topic in enumerate(topics):
96+
def update_this_relevancy(var_, topic_):
97+
"""Helper function to bind the variables to scope."""
98+
return lambda: update_relevancy(f"q{var_}", topic_)
99+
100+
# We need to use the on_change callbacks instead of the regular
101+
# return values, because state needs to be up-to-date *before*
102+
# the next render pass.
103+
st.checkbox(
104+
label=topic,
105+
value=(topic in st.session_state[UNSAVED_DATA][did]),
106+
key=f"q{i}",
107+
on_change=update_this_relevancy(i, topic),
108+
)
126109

127110

128111
unsaved_changes = (st.session_state[UNSAVED_DATA] != st.session_state[LOADED_DATA])

0 commit comments

Comments
 (0)