Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -230,20 +230,18 @@ def re_rank_candidates(query, candidates, method):
|
|
| 230 |
key=lambda x: x[1]['cross_score'] + x[1]['bi_score'],
|
| 231 |
reverse=True
|
| 232 |
)
|
| 233 |
-
|
| 234 |
-
# Convert the list of dictionaries into a DataFrame
|
| 235 |
-
df = pd.DataFrame(data_dicts)
|
| 236 |
-
return df
|
| 237 |
|
| 238 |
col1, col2 = st.columns(2)
|
| 239 |
if st.button('Generated Expansion'):
|
| 240 |
candidates = generate_query_expansion_candidates(query = user_query)
|
| 241 |
-
col1
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
col2
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
|
|
|
|
|
| 230 |
key=lambda x: x[1]['cross_score'] + x[1]['bi_score'],
|
| 231 |
reverse=True
|
| 232 |
)
|
| 233 |
+
return filtered_sorted_result
|
|
|
|
|
|
|
|
|
|
| 234 |
|
| 235 |
col1, col2 = st.columns(2)
|
| 236 |
if st.button('Generated Expansion'):
|
| 237 |
candidates = generate_query_expansion_candidates(query = user_query)
|
| 238 |
+
with col1:
|
| 239 |
+
st.header('Raw Candidates:')
|
| 240 |
+
candidates_rerank = re_rank_candidates(user_query, candidates, method='cross_encoder')[:maxtags_sidebar]
|
| 241 |
+
result = [item[0] for item in candidates_rerank]
|
| 242 |
+
st.write(result)
|
| 243 |
+
with col2:
|
| 244 |
+
st.header('Rerank By GMS:')
|
| 245 |
+
candidates_rerank = re_rank_candidates(user_query, candidates, method='gms')[:maxtags_sidebar]
|
| 246 |
+
result = [{item[0]: item[1]['gms']} for item in candidates_rerank]
|
| 247 |
+
st.json(result)
|