yinlinfu commited on
Commit
db1f600
·
1 Parent(s): ec1fdd6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -13
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
- data_dicts = [{'query': item[0], **item[1]} for item in filtered_sorted_result]
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.subheader('Raw Candidates:')
242
- df = re_rank_candidates(user_query, candidates, method='cross_encoder')
243
- result = list(df['query'][:maxtags_sidebar])
244
- st.write(result)
245
-
246
- col2.subheader('Rerank By GMS:')
247
- df = re_rank_candidates(user_query, candidates, method='gms')
248
- result = df[['query', 'gms']][:maxtags_sidebar]
249
- st.json(result.to_dict('list'))
 
 
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)