Spaces:
Sleeping
Sleeping
update
Browse files
app.py
CHANGED
@@ -5,28 +5,16 @@ 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 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 💡")
|
27 |
|
28 |
data = load_data()
|
29 |
|
|
|
30 |
st.sidebar.header("Search Options")
|
31 |
chat_model_query = st.sidebar.text_input("Chat Model")
|
32 |
embedding_model_query = st.sidebar.text_input("Embedding Model")
|
@@ -37,28 +25,42 @@ def main():
|
|
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:
|
41 |
data = case_insensitive_search(data, chunk_query, 'chunk')
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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(
|
55 |
"Please cite this dataset as:\n"
|
56 |
"Tang, Yixuan, and Yi Yang. MultiHop-RAG: Benchmarking Retrieval-Augmented Generation for Multi-Hop Queries. ArXiv, 2024, /abs/2401.15391."
|
57 |
)
|
58 |
-
st.markdown("---")
|
59 |
-
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. '")
|
60 |
-
st.markdown("---")
|
61 |
-
st.caption("For results self-reporting, please send an email to [email protected]")
|
62 |
|
63 |
if __name__ == "__main__":
|
64 |
main()
|
|
|
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 |
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()
|