@@ -81,48 +81,31 @@ def load_label_data() -> dict[int, list[str]]:
81
81
82
82
83
83
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?" )
94
86
95
87
def update_relevancy (var , topic ):
96
- print (st .session_state [var ], topic )
97
88
if st .session_state [var ] and topic not in st .session_state [UNSAVED_DATA ][did ]:
98
89
st .session_state [UNSAVED_DATA ][did ].append (topic )
99
90
if not st .session_state [var ] and topic in st .session_state [UNSAVED_DATA ][did ]:
100
91
st .session_state [UNSAVED_DATA ][did ].remove (topic )
101
92
102
93
103
94
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
+ )
126
109
127
110
128
111
unsaved_changes = (st .session_state [UNSAVED_DATA ] != st .session_state [LOADED_DATA ])
0 commit comments