yixuantt commited on
Commit
c3a1125
·
1 Parent(s): 1350777
Files changed (1) hide show
  1. app.py +18 -16
app.py CHANGED
@@ -9,12 +9,18 @@ def case_insensitive_search(data, query, column):
9
  return data[data[column].str.lower().str.contains(query.lower())]
10
  return data
11
 
12
- def display_table(data, rows_per_page=10, height=None):
13
- container = st.container()
14
- with container:
15
- if height is None:
16
- height = min(40 + rows_per_page * 38, 800)
17
- st.dataframe(data, height=height)
 
 
 
 
 
 
18
 
19
  def main():
20
  st.title("Multihop-RAG Benchmark 💡")
@@ -36,17 +42,13 @@ def main():
36
  if frame_query:
37
  data = case_insensitive_search(data, frame_query, 'framework')
38
 
39
- # Display settings
40
- st.header("Settings")
41
- display_table(data[['framework', 'chat_model', 'embedding_model', 'chunk']])
42
 
43
- # Display retrieval metrics
44
- st.header("Retrieval Metrics")
45
- display_table(data[['MRR@10', 'Hit@10']])
46
-
47
- # Display response metrics
48
- st.header("Response Metrics")
49
- display_table(data[['Accuracy']])
50
 
51
  st.sidebar.header("Citation")
52
  st.sidebar.info(
 
9
  return data[data[column].str.lower().str.contains(query.lower())]
10
  return data
11
 
12
+ def display_table(data):
13
+ # 设置多级列索引
14
+ data.columns = pd.MultiIndex.from_tuples([
15
+ ("Settings", "Framework"),
16
+ ("Settings", "Chat Model"),
17
+ ("Settings", "Embedding Model"),
18
+ ("Settings", "Chunk"),
19
+ ("Retrieval Metrics", "MRR@10"),
20
+ ("Retrieval Metrics", "Hit@10"),
21
+ ("Response Metrics", "Accuracy")
22
+ ])
23
+ st.dataframe(data, height=600)
24
 
25
  def main():
26
  st.title("Multihop-RAG Benchmark 💡")
 
42
  if frame_query:
43
  data = case_insensitive_search(data, frame_query, 'framework')
44
 
45
+ # 根据需要选择列
46
+ data = data[['framework', 'chat_model', 'embedding_model', 'chunk', 'MRR@10', 'Hit@10', 'Accuracy']]
47
+ display_table(data)
48
 
49
+ if st.sidebar.checkbox("Show Metrics Distribution"):
50
+ st.subheader("Metrics Distribution")
51
+ st.bar_chart(data[['MRR@10', 'Hit@10', 'Accuracy']])
 
 
 
 
52
 
53
  st.sidebar.header("Citation")
54
  st.sidebar.info(