yixuantt commited on
Commit
aad2007
1 Parent(s): 7cb5ca9
Files changed (2) hide show
  1. app.py +21 -9
  2. benchmark_data.csv +9 -11
app.py CHANGED
@@ -11,6 +11,15 @@ def case_insensitive_search(data, query, column):
11
  return data[data[column].str.lower().str.contains(query.lower())]
12
  return data
13
 
 
 
 
 
 
 
 
 
 
14
  # 页面布局和功能
15
  def main():
16
  st.title("Multihop-RAG Benchmark Space")
@@ -19,24 +28,27 @@ def main():
19
 
20
  # 添加搜索框
21
  st.sidebar.header("Search Options")
22
- framework_query = st.sidebar.text_input("Search by Framework")
23
- model_query = st.sidebar.text_input("Search by Model")
 
24
 
25
  # 根据输入执行搜索
26
- if framework_query:
27
- data = case_insensitive_search(data, framework_query, 'framework')
28
- if model_query:
29
- data = case_insensitive_search(data, model_query, 'model')
 
 
30
 
31
  # 显示数据
32
  st.header("Benchmark Results")
33
- st.write("Displaying results for MRR@10 and Hit@10 across different frameworks, models, and chunk sizes.")
34
- st.dataframe(data)
35
 
36
  # 数据统计和图表
37
  if st.sidebar.checkbox("Show Metrics Distribution"):
38
  st.subheader("Metrics Distribution")
39
- st.bar_chart(data[['MRR@10', 'Hit@10']])
40
 
41
  if __name__ == "__main__":
42
  main()
 
11
  return data[data[column].str.lower().str.contains(query.lower())]
12
  return data
13
 
14
+ # 创建一个带有滚动条的表格显示函数
15
+ def display_table(data, rows_per_page=20):
16
+ # 使用 Streamlit 的 container 来创建滚动效果
17
+ container = st.container()
18
+ with container:
19
+ # 设置表格高度,基于每行的大致高度估算
20
+ height = min(40 + rows_per_page * 38, 800) # 最大高度为800像素
21
+ st.dataframe(data, height=height)
22
+
23
  # 页面布局和功能
24
  def main():
25
  st.title("Multihop-RAG Benchmark Space")
 
28
 
29
  # 添加搜索框
30
  st.sidebar.header("Search Options")
31
+ chat_model_query = st.sidebar.text_input("Search by Chat Model")
32
+ embedding_model_query = st.sidebar.text_input("Search by Embedding Model")
33
+ chunk_query = st.sidebar.text_input("Search by Chunk") # 新增按 Chunk 搜索
34
 
35
  # 根据输入执行搜索
36
+ if chat_model_query:
37
+ data = case_insensitive_search(data, chat_model_query, 'chat_model')
38
+ if embedding_model_query:
39
+ data = case_insensitive_search(data, embedding_model_query, 'embedding_model')
40
+ if chunk_query: # 新增 Chunk 的筛选
41
+ data = case_insensitive_search(data, chunk_query, 'chunk')
42
 
43
  # 显示数据
44
  st.header("Benchmark Results")
45
+ st.write("Displaying results for MRR@10, Hit@10, and Accuracy across different frameworks, embedding models, chat models, and chunks.")
46
+ display_table(data) # 使用自定义的表格显示函数
47
 
48
  # 数据统计和图表
49
  if st.sidebar.checkbox("Show Metrics Distribution"):
50
  st.subheader("Metrics Distribution")
51
+ st.bar_chart(data[['MRR@10', 'Hit@10', 'Accuracy']]) # 添加Accuracy到图表中
52
 
53
  if __name__ == "__main__":
54
  main()
benchmark_data.csv CHANGED
@@ -1,11 +1,9 @@
1
- framework,model,chunk size,MRR@10,Hit@10
2
- Transformers,BERT-base,128,0.32,0.45
3
- Transformers,BERT-large,256,0.37,0.50
4
- Fairseq,ROBERTA-base,128,0.35,0.48
5
- Fairseq,ROBERTA-large,256,0.40,0.55
6
- HuggingFace,GPT-2,128,0.30,0.44
7
- HuggingFace,GPT-3,256,0.42,0.57
8
- TensorFlow,T5-small,128,0.31,0.46
9
- TensorFlow,T5-large,256,0.39,0.51
10
- PyTorch,BART-base,128,0.33,0.47
11
- PyTorch,BART-large,256,0.38,0.53
 
1
+ framework,chat_model,embedding_model,chunk,MRR@10,Hit@10,Accuracy
2
+ Framework1,ChatModelA,EmbeddingModel1,Chunk1,0.32,0.78,0.88
3
+ Framework2,ChatModelB,EmbeddingModel2,Chunk2,0.25,0.65,0.90
4
+ Framework1,ChatModelC,EmbeddingModel1,Chunk1,0.37,0.85,0.92
5
+ Framework3,ChatModelA,EmbeddingModel3,Chunk3,0.29,0.75,0.89
6
+ Framework2,ChatModelB,EmbeddingModel2,Chunk2,0.31,0.70,0.87
7
+ Framework3,ChatModelC,EmbeddingModel3,Chunk3,0.35,0.80,0.93
8
+ Framework1,ChatModelA,EmbeddingModel1,Chunk1,0.33,0.82,0.91
9
+ Framework2,ChatModelB,EmbeddingModel2,Chunk2,0.26,0.68,0.85