yixuantt commited on
Commit
250af9b
·
1 Parent(s): 6d870aa
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -1,39 +1,39 @@
1
  import streamlit as st
2
  import pandas as pd
3
- from fuzzywuzzy import process
4
-
5
 
 
6
  def load_data():
7
  return pd.read_csv("benchmark_data.csv")
8
 
9
-
10
- def fuzzy_search(data, query, column):
11
- if query:
12
- choices = data[column].unique()
13
- results = process.extract(query, choices, limit=10)
14
- selected = [res[0] for res in results]
15
- return data[data[column].isin(selected)]
16
  return data
17
 
18
-
19
  def main():
20
  st.title("Multihop-RAG Benchmark Space")
21
 
22
  data = load_data()
23
 
 
24
  st.sidebar.header("Search Options")
25
  framework_query = st.sidebar.text_input("Search by Framework")
26
  model_query = st.sidebar.text_input("Search by Model")
27
 
 
28
  if framework_query:
29
- data = fuzzy_search(data, framework_query, 'framework')
30
  if model_query:
31
- data = fuzzy_search(data, model_query, 'model')
32
 
 
33
  st.header("Benchmark Results")
34
  st.write("Displaying results for MRR@10 and Hit@10 across different frameworks, models, and chunk sizes.")
35
  st.dataframe(data)
36
 
 
37
  if st.sidebar.checkbox("Show Metrics Distribution"):
38
  st.subheader("Metrics Distribution")
39
  st.bar_chart(data[['MRR@10', 'Hit@10']])
 
1
  import streamlit as st
2
  import pandas as pd
 
 
3
 
4
+ # 假设你的数据存储在一个CSV文件中,我们将从这个文件中读取数据
5
  def load_data():
6
  return pd.read_csv("benchmark_data.csv")
7
 
8
+ # 不区分大小写的搜索功能
9
+ def case_insensitive_search(data, query, column):
10
+ if query: # 如果用户输入了搜索词
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")
17
 
18
  data = load_data()
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']])