yixuantt commited on
Commit
feaef97
1 Parent(s): 5c300c5
Files changed (1) hide show
  1. app.py +20 -28
app.py CHANGED
@@ -1,20 +1,26 @@
1
  import streamlit as st
2
  import pandas as pd
3
 
 
4
  def load_data():
5
  return pd.read_csv("benchmark_data.csv")
6
 
7
  def case_insensitive_search(data, query, column):
8
- if query:
9
  return data[data[column].str.lower().str.contains(query.lower())]
10
  return data
11
 
 
 
 
 
 
 
12
  def main():
13
  st.title("Multihop-RAG Benchmark 💡")
14
 
15
  data = load_data()
16
 
17
- # 筛选条件
18
  st.sidebar.header("Search Options")
19
  chat_model_query = st.sidebar.text_input("Chat Model")
20
  embedding_model_query = st.sidebar.text_input("Embedding Model")
@@ -25,42 +31,28 @@ def main():
25
  data = case_insensitive_search(data, chat_model_query, 'chat_model')
26
  if embedding_model_query:
27
  data = case_insensitive_search(data, embedding_model_query, 'embedding_model')
28
- if chunk_query:
29
  data = case_insensitive_search(data, chunk_query, 'chunk')
30
  if frame_query:
31
  data = case_insensitive_search(data, frame_query, 'framework')
32
 
33
- # 创建多级列索引
34
- columns = [
35
- ("Settings", "Framework"),
36
- ("Settings", "Chat Model"),
37
- ("Settings", "Embedding Model"),
38
- ("Settings", "Chunk"),
39
- ("Retrieval Metrics", "MRR@10"),
40
- ("Retrieval Metrics", "Hit@10"),
41
- ("Response Metrics", "Accuracy")
42
- ]
43
 
44
- # 选择并设置多级列索引
45
- data = data[['framework', 'chat_model', 'embedding_model', 'chunk', 'MRR@10', 'Hit@10', 'Accuracy']]
46
- data.columns = pd.MultiIndex.from_tuples(columns)
47
 
48
- # 展示数据
49
- st.dataframe(data.style.set_table_styles([{
50
- 'selector': 'th',
51
- 'props': [('background-color', '#f4f4f4'), ('font-weight', 'bold')]
52
- }]), height=600)
53
 
54
- if st.sidebar.checkbox("Show Metrics Distribution"):
55
- st.subheader("Metrics Distribution")
56
- st.bar_chart(data[['MRR@10', 'Hit@10', 'Accuracy']])
57
-
58
- # 引用
59
  st.sidebar.header("Citation")
60
  st.sidebar.info(
61
  "Please cite this dataset as:\n"
62
- "Tang, Yixuan, and Yi Yang. MultiHop-RAG: Benchmarking Retrieval-Augmented Generation for Multi-Hop Queries. ArXiv, 2024, /abs/2401.15391."
63
  )
64
-
 
 
 
 
65
  if __name__ == "__main__":
66
  main()
 
1
  import streamlit as st
2
  import pandas as pd
3
 
4
+
5
  def load_data():
6
  return pd.read_csv("benchmark_data.csv")
7
 
8
  def case_insensitive_search(data, query, column):
9
+ if query:
10
  return data[data[column].str.lower().str.contains(query.lower())]
11
  return data
12
 
13
+ def display_table(data, rows_per_page=10):
14
+ container = st.container()
15
+ with container:
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 💡")
21
 
22
  data = load_data()
23
 
 
24
  st.sidebar.header("Search Options")
25
  chat_model_query = st.sidebar.text_input("Chat Model")
26
  embedding_model_query = st.sidebar.text_input("Embedding Model")
 
31
  data = case_insensitive_search(data, chat_model_query, 'chat_model')
32
  if embedding_model_query:
33
  data = case_insensitive_search(data, embedding_model_query, 'embedding_model')
34
+ if chunk_query:
35
  data = case_insensitive_search(data, chunk_query, 'chunk')
36
  if frame_query:
37
  data = case_insensitive_search(data, frame_query, 'framework')
38
 
39
+ st.write("Displaying results for MRR@10, Hit@10, and Accuracy across different frameworks, embedding models, chat models, and chunks.")
40
+ display_table(data)
 
 
 
 
 
 
 
 
41
 
42
+ # if st.sidebar.checkbox("Show Metrics Distribution"):
43
+ # st.subheader("Metrics Distribution")
44
+ # st.bar_chart(data[['MRR@10', 'Hit@10', 'Accuracy']])
45
 
 
 
 
 
 
46
 
 
 
 
 
 
47
  st.sidebar.header("Citation")
48
  st.sidebar.info(
49
  "Please cite this dataset as:\n"
50
+ "Tang, Yixuan, and Yi Yang. MultiHop-RAG: Benchmarking Retrieval-Augmented Generation for Multi-Hop Queries. ArXiv, 2024, /abs/2401.15391."
51
  )
52
+ st.markdown("---")
53
+ st.caption("For citation, please use: 'Tang, Yixuan, and Yi Yang. MultiHop-RAG: Benchmarking Retrieval-Augmented Generation for Multi-Hop Queries. ArXiv, 2024, /abs/2401.15391. '")
54
+ st.markdown("---")
55
+ st.caption("For results self-reporting, please send an email to ytangch@connect.ust.hk")
56
+
57
  if __name__ == "__main__":
58
  main()