smile commited on
Commit
f646fc1
·
1 Parent(s): b9e2d5a

Update to V0.2

Browse files
app.py CHANGED
@@ -1,15 +1,8 @@
1
- # -*- coding: utf-8 -*-
2
- # @Date : 2024/12/24 16:59
3
- # @Author : q275343119
4
- # @File : app.py
5
- # @Description: Main entry point for the application
6
  from app.ui.home import init_home
7
  from app.ui.about import init_about
8
 
9
  import gradio as gr
10
 
11
-
12
-
13
  home = init_home()
14
  about = init_about()
15
 
@@ -19,5 +12,3 @@ demo = gr.TabbedInterface(
19
  css="footer {display: none} .sort-button.svelte-1bvc1p0.svelte-1bvc1p0.svelte-1bvc1p0 {display: none;}"
20
  )
21
  demo.launch()
22
-
23
-
 
 
 
 
 
 
1
  from app.ui.home import init_home
2
  from app.ui.about import init_about
3
 
4
  import gradio as gr
5
 
 
 
6
  home = init_home()
7
  about = init_about()
8
 
 
12
  css="footer {display: none} .sort-button.svelte-1bvc1p0.svelte-1bvc1p0.svelte-1bvc1p0 {display: none;}"
13
  )
14
  demo.launch()
 
 
app/__init__.py CHANGED
@@ -1,5 +1 @@
1
- # -*- coding: utf-8 -*-
2
- # @Date : 2024/12/24 17:13
3
- # @Author : q275343119
4
- # @File : __init__.py.py
5
- # @Description:
 
1
+
 
 
 
 
app/backend/__init__.py CHANGED
@@ -1,5 +1 @@
1
- # -*- coding: utf-8 -*-
2
- # @Date : 2024/12/24 17:16
3
- # @Author : q275343119
4
- # @File : __init__.py.py
5
- # @Description: Backend module initialization
 
1
+
 
 
 
 
app/backend/constant.py CHANGED
@@ -44,3 +44,44 @@ class EvaluationMetric(Enum):
44
  PRECISION_20 = "PRECISION@20"
45
  PRECISION_50 = "PRECISION@50"
46
  PRECISION_100 = "PRECISION@100"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  PRECISION_20 = "PRECISION@20"
45
  PRECISION_50 = "PRECISION@50"
46
  PRECISION_100 = "PRECISION@100"
47
+
48
+
49
+ class EmbdDtype(Enum):
50
+ ALL = "all"
51
+ FLOAT_32 = "float32"
52
+ INT_8 = "int8"
53
+ BINARY = "binary"
54
+
55
+
56
+ class EmbdDim(Enum):
57
+ OP1 = "<=1k"
58
+ OP2 = "1k-2k"
59
+ OP3 = "2k-5k"
60
+ OP4 = ">=5k"
61
+
62
+
63
+ class Similarity(Enum):
64
+ ALL = "all"
65
+ COSINE = "cosine"
66
+ DOT = "dot"
67
+ EUCLIDEAN = "euclidean"
68
+
69
+
70
+ LEADERBOARD_MAP = {
71
+ "text": [
72
+ "law",
73
+ "long-context",
74
+ "finance",
75
+ "conversational",
76
+ "tech",
77
+ "multilingual",
78
+ "code",
79
+ "healthcare"
80
+ ],
81
+ "multimodal": [
82
+ "text-to-photo",
83
+ "document-screenshot",
84
+ "figures-and-tables",
85
+ "text-to-text"
86
+ ]
87
+ }
app/backend/data_engine.py CHANGED
@@ -7,6 +7,27 @@ from typing import List
7
  import pandas as pd
8
 
9
  from app.backend.constant import ModelProvider
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
 
12
  class DataEngine:
@@ -14,14 +35,6 @@ class DataEngine:
14
  def __init__(self):
15
  self.df = self.init_dataframe()
16
 
17
- @property
18
- def leaderboards(self):
19
- """
20
- Get leaderboard data
21
- """
22
- with open('./mock_data/leaderboard.json', 'r') as f:
23
- return json.load(f)
24
-
25
  @property
26
  def models(self):
27
  """
@@ -31,11 +44,11 @@ class DataEngine:
31
  return json.load(f)
32
 
33
  @property
34
- def tasks(self):
35
  """
36
  Get tasks data
37
  """
38
- with open('./mock_data/tasks.json', 'r') as f:
39
  return json.load(f)
40
 
41
  @property
@@ -62,121 +75,69 @@ class DataEngine:
62
  return True
63
  return organization in providers
64
 
65
- def filter_df(self, leaderboard: str, task: str, providers: List, sort_key: str):
66
-
67
- tasks = []
68
- for lb in self.leaderboards:
69
- if lb["name"] == leaderboard:
70
- tasks = lb["tasks"]
71
- break
72
- df_list = []
73
- for t in (filter(lambda x: x.upper() == task.upper(), tasks)):
74
- datasets = []
75
- for ta in self.tasks:
76
- if ta["slug"].upper() == t.upper():
77
- datasets = ta["datasets"]
78
- break
79
- for model in self.models:
80
- if t in model["tasks"] and self._check_providers(model["organization"], providers):
81
-
82
- for dataset in datasets:
83
- results = self.results[dataset]
84
- for result in results:
85
- if result['model_name'] == model["model_name"]:
86
- d = result["results"]
87
- d["class"] = result["class"]
88
- d["organization"] = result["organization"]
89
- d["model_name"] = result["model_name"]
90
- df = pd.DataFrame([d])
91
- df = df[["class", "organization", "model_name", "ndcg_at_1", "ndcg_at_3", "ndcg_at_5",
92
- "ndcg_at_10",
93
- "ndcg_at_20", "ndcg_at_50", "ndcg_at_100", "recall_at_1", "recall_at_3",
94
- "recall_at_5", "recall_at_10",
95
- "recall_at_20", "recall_at_50", "recall_at_100", "precision_at_1",
96
- "precision_at_3", "precision_at_5",
97
- "precision_at_10", "precision_at_20", "precision_at_50", "precision_at_100"]]
98
- df_list.append(df)
99
- if df_list:
100
- return pd.concat(df_list).sort_values(by=sort_key.replace("@", '_at_').lower())
101
- return pd.DataFrame(columns=["class", "organization", "model_name", "ndcg_at_1", "ndcg_at_3", "ndcg_at_5",
102
- "ndcg_at_10",
103
- "ndcg_at_20", "ndcg_at_50", "ndcg_at_100", "recall_at_1", "recall_at_3",
104
- "recall_at_5", "recall_at_10",
105
- "recall_at_20", "recall_at_50", "recall_at_100", "precision_at_1",
106
- "precision_at_3", "precision_at_5",
107
- "precision_at_10", "precision_at_20", "precision_at_50", "precision_at_100"])
108
-
109
- def get_model_result(self, model: dict, task_datasets_map: dict, results: dict):
110
- """
111
- get_model_result
112
- """
113
- model_class = model["class"]
114
- model_organization = model["organization"]
115
- model_model_name = model["model_name"]
116
- for leaderboard in model["leaderboards"]:
117
- for task in model["tasks"]:
118
- for dateset in task_datasets_map.get(task, []):
119
- for result in results[dateset]:
120
- if result["model_name"] == model_model_name:
121
- d_result = result["results"]
122
- d_result["class"] = model_class
123
- d_result["organization"] = model_organization
124
- d_result["model_name"] = model_model_name
125
- d_result["leaderboard"] = leaderboard
126
- d_result["dateset"] = dateset
127
- d_result["task"] = task
128
- yield d_result
129
-
130
  def jsons_to_df(self):
131
 
132
- # change leaderboards to task_leaderboard_map
133
- task_leaderboard_map = {}
134
- leaderboards = self.leaderboards
135
- for leaderboard in leaderboards:
136
- for task in leaderboard["tasks"]:
137
- task_leaderboard_map[task] = leaderboard["name"]
138
-
139
- # change tasks to task_datasets_map
140
- task_datasets_map = {}
141
- for task in self.tasks:
142
- task_datasets_map[task["slug"]] = task["datasets"]
143
-
144
  df_results_list = []
145
- results = self.results
146
- for model in self.models:
147
- for d_result in self.get_model_result(model, task_datasets_map, results):
148
- if d_result:
149
- df_results_list.append(pd.DataFrame([d_result]))
150
-
151
- if df_results_list:
152
- df_result = pd.concat(df_results_list)
153
- return df_result[
154
- ["leaderboard", "task", "class", "organization", "model_name", "dateset", "ndcg_at_1", "ndcg_at_3",
155
- "ndcg_at_5",
156
- "ndcg_at_10",
157
- "ndcg_at_20", "ndcg_at_50", "ndcg_at_100", "recall_at_1", "recall_at_3",
158
- "recall_at_5", "recall_at_10",
159
- "recall_at_20", "recall_at_50", "recall_at_100", "precision_at_1",
160
- "precision_at_3", "precision_at_5",
161
- "precision_at_10", "precision_at_20", "precision_at_50", "precision_at_100"]], leaderboards
162
- return pd.DataFrame(
163
- columns=["leaderboard", "task", "class", "organization", "model_name", "dateset", "ndcg_at_1", "ndcg_at_3",
164
- "ndcg_at_5",
165
- "ndcg_at_10",
166
- "ndcg_at_20", "ndcg_at_50", "ndcg_at_100", "recall_at_1", "recall_at_3",
167
- "recall_at_5", "recall_at_10",
168
- "recall_at_20", "recall_at_50", "recall_at_100", "precision_at_1",
169
- "precision_at_3", "precision_at_5",
170
- "precision_at_10", "precision_at_20", "precision_at_50", "precision_at_100"]), leaderboards
171
-
172
- def filter_by_providers(self, df_result: pd.DataFrame, providers: List):
 
 
 
 
 
173
  """
174
  filter_by_providers
175
  """
176
- if not providers:
177
- # providers are empty, return empty
178
  return df_result[0:0]
179
- return df_result[df_result['organization'].apply(lambda x: self._check_providers(x, providers))]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
 
181
  def summarize_dataframe(self):
182
  """
 
7
  import pandas as pd
8
 
9
  from app.backend.constant import ModelProvider
10
+ from utils.cache_decorator import cache_with_custom_key
11
+
12
+ COLUMNS = ['model_name', 'group_name', 'leaderboard', 'dataset_name',
13
+ 'embd_dtype', 'embd_dim', 'num_params', 'max_tokens', 'similarity',
14
+ 'query_instruct', 'corpus_instruct', 'ndcg_at_1', 'ndcg_at_3', 'ndcg_at_5',
15
+ 'ndcg_at_10', 'ndcg_at_20',
16
+ 'ndcg_at_50', 'ndcg_at_100', 'recall_at_1', 'recall_at_3',
17
+ 'recall_at_5', 'recall_at_10', 'recall_at_20', 'recall_at_50',
18
+ 'recall_at_100', 'precision_at_1', 'precision_at_3', 'precision_at_5',
19
+ 'precision_at_10', 'precision_at_20', 'precision_at_50',
20
+ 'precision_at_100']
21
+
22
+ COLUMNS_TYPES = ["markdown", "str", 'str', 'str',
23
+ 'str', 'str', 'number', 'number', 'str',
24
+ 'str', 'str', 'number', 'number', 'number',
25
+ 'number', 'number',
26
+ 'number', 'number', 'number', 'number',
27
+ 'number', 'number', 'number', 'number',
28
+ 'number', 'number', 'number', 'number',
29
+ 'number', 'number', 'number',
30
+ 'number']
31
 
32
 
33
  class DataEngine:
 
35
  def __init__(self):
36
  self.df = self.init_dataframe()
37
 
 
 
 
 
 
 
 
 
38
  @property
39
  def models(self):
40
  """
 
44
  return json.load(f)
45
 
46
  @property
47
+ def datasets(self):
48
  """
49
  Get tasks data
50
  """
51
+ with open('./mock_data/datasets.json', 'r') as f:
52
  return json.load(f)
53
 
54
  @property
 
75
  return True
76
  return organization in providers
77
 
78
+ @cache_with_custom_key("json_result")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  def jsons_to_df(self):
80
 
81
+ results_list = self.results
 
 
 
 
 
 
 
 
 
 
 
82
  df_results_list = []
83
+ for result_dict in results_list:
84
+ dataset_name = result_dict["dataset_name"]
85
+ df_result_row = pd.DataFrame(result_dict["results"])
86
+ df_result_row["dataset_name"] = dataset_name
87
+ df_results_list.append(df_result_row)
88
+ df_result = pd.concat(df_results_list)
89
+
90
+ df_datasets_list = []
91
+ for item in self.datasets:
92
+ dataset_names = item["dataset_names"]
93
+ df_dataset_row = pd.DataFrame(
94
+ {
95
+ "group_name": [item["group_name"] for _ in range(len(dataset_names))],
96
+ "dataset_name": dataset_names,
97
+ "leaderboard": [item["leaderboard"] for _ in range(len(dataset_names))]
98
+ }
99
+ )
100
+ df_datasets_list.append(df_dataset_row)
101
+ df_dataset = pd.concat(df_datasets_list).drop_duplicates()
102
+
103
+ models_list = self.models
104
+
105
+ df_model = pd.DataFrame(models_list)
106
+
107
+ df = pd.merge(df_result, df_model, on="model_name", how="inner")
108
+ df = pd.merge(df, df_dataset, on="dataset_name", how="inner")
109
+
110
+ df["model_name"] = df.apply(lambda
111
+ x: f"""<a target=\"_blank\" style=\"text-decoration: underline\" href=\"{x["reference"]}\">{x["model_name"]}</a>""",
112
+ axis=1)
113
+ return df[COLUMNS]
114
+
115
+ def filter_df(self, df_result: pd.DataFrame, embd_dtype: str, embd_dims: List, similarity: str, max_tokens: int):
116
  """
117
  filter_by_providers
118
  """
119
+ if not embd_dims:
 
120
  return df_result[0:0]
121
+
122
+ if embd_dtype and embd_dtype != "all":
123
+ df_result = df_result[df_result['embd_dtype'] == embd_dtype][:]
124
+
125
+ if similarity and similarity != "all":
126
+ df_result = df_result[df_result['similarity'] == similarity][:]
127
+
128
+ if max_tokens:
129
+ df_result = df_result[df_result['max_tokens'] >= max_tokens][:]
130
+
131
+ if embd_dims:
132
+ bins = [0, 1000, 2000, 5000, float('inf')]
133
+ labels = ['<=1k', '1k-2k', '2k-5k', '>=5k']
134
+
135
+ # 使用 pd.cut 进行分组
136
+ df_result['value_group'] = pd.cut(df_result['embd_dim'], bins=bins, labels=labels, right=False)
137
+ df_result = df_result[df_result['value_group'].isin(embd_dims)]
138
+ df_result = df_result[COLUMNS]
139
+
140
+ return df_result
141
 
142
  def summarize_dataframe(self):
143
  """
app/ui/__init__.py CHANGED
@@ -1,5 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # @Date : 2024/12/24 17:16
3
- # @Author : q275343119
4
- # @File : __init__.py.py
5
- # @Description:
 
 
 
 
 
 
app/ui/about.py CHANGED
@@ -1,9 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
- # @Date : 2024/12/24 17:20
3
- # @Author : q275343119
4
- # @File : about.py
5
- # @Description: About page implementation
6
-
7
  import gradio as gr
8
 
9
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
 
app/ui/component/__init__.py CHANGED
@@ -1,5 +1 @@
1
- # -*- coding: utf-8 -*-
2
- # @Date : 2024/12/24 17:25
3
- # @Author : q275343119
4
- # @File : __init__.py.py
5
- # @Description:
 
1
+
 
 
 
 
app/ui/component/filter_component.py CHANGED
@@ -1,8 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
- # @Date : 2024/12/24 17:26
3
- # @Author : q275343119
4
- # @File : filter_component.py
5
- # @Description: Filter component implementation
6
  """
7
  Filter component for data filtering
8
  """
@@ -15,12 +10,27 @@ from app.backend.data_engine import DataEngine
15
  class FilterComponent:
16
 
17
  def __init__(self, data_engine: DataEngine, navigations: List, model_provides: List,
18
- evaluation_metrics: List):
19
  self.data_engine = data_engine
20
  self.navigations = navigations
21
  self.task_categories = []
22
  self.model_provides = model_provides
23
  self.evaluation_metrics = evaluation_metrics
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  def show(self):
26
  with gr.Row():
@@ -40,7 +50,42 @@ class FilterComponent:
40
  interactive=True,
41
  elem_classes=["filter-checkbox-group"],
42
  scale=2,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  evaluation_metrics = gr.Dropdown(
45
  label="Evaluation Metrics",
46
  choices=self.evaluation_metrics,
@@ -50,4 +95,5 @@ class FilterComponent:
50
  scale=2,
51
  )
52
 
53
- return navigations, model_provides, evaluation_metrics
 
 
 
 
 
 
 
1
  """
2
  Filter component for data filtering
3
  """
 
10
  class FilterComponent:
11
 
12
  def __init__(self, data_engine: DataEngine, navigations: List, model_provides: List,
13
+ evaluation_metrics: List, embd_dtypes: List, embd_dims: List, similarities: List):
14
  self.data_engine = data_engine
15
  self.navigations = navigations
16
  self.task_categories = []
17
  self.model_provides = model_provides
18
  self.evaluation_metrics = evaluation_metrics
19
+ self.embd_dtypes = embd_dtypes
20
+ self.embd_dims = embd_dims
21
+ self.similarities = similarities
22
+
23
+ def _validate_input(self,value:str):
24
+ if value == "":
25
+ return value
26
+ try:
27
+ num = int(value)
28
+ if num > 0:
29
+ return num
30
+ else:
31
+ return ""
32
+ except ValueError:
33
+ return ""
34
 
35
  def show(self):
36
  with gr.Row():
 
50
  interactive=True,
51
  elem_classes=["filter-checkbox-group"],
52
  scale=2,
53
+ visible=False
54
+ )
55
+ embd_dtypes = gr.Dropdown(
56
+ label="Embd Dtype",
57
+ choices=self.embd_dtypes,
58
+ value=self.embd_dtypes[0],
59
+ interactive=True,
60
+ elem_classes=["filter-checkbox-group"],
61
+ scale=2,
62
+
63
+ )
64
+
65
+ embd_dims = gr.CheckboxGroup(
66
+ label="Embd Dim",
67
+ choices=self.embd_dims,
68
+ value=self.embd_dims,
69
+ interactive=True,
70
+ elem_classes=["filter-checkbox-group"],
71
+ scale=2,
72
  )
73
+
74
+ similarities = gr.Dropdown(
75
+ label="Similarity",
76
+ choices=self.similarities,
77
+ value=self.similarities[0],
78
+ interactive=True,
79
+ elem_classes=["filter-checkbox-group"],
80
+ scale=2,
81
+
82
+ )
83
+
84
+ max_tokens = gr.Number(
85
+ label="Max Tokens",
86
+
87
+ )
88
+
89
  evaluation_metrics = gr.Dropdown(
90
  label="Evaluation Metrics",
91
  choices=self.evaluation_metrics,
 
95
  scale=2,
96
  )
97
 
98
+
99
+ return navigations, model_provides, evaluation_metrics, embd_dtypes, embd_dims, similarities, max_tokens
app/ui/component/subtabs_component.py CHANGED
@@ -2,7 +2,8 @@ from typing import List
2
  import gradio as gr
3
  import pandas as pd
4
 
5
- from app.backend.data_engine import DataEngine
 
6
 
7
 
8
  class SubtabsComponent:
@@ -10,37 +11,45 @@ class SubtabsComponent:
10
  def __init__(self, data_engine: DataEngine):
11
  self.data_engine = data_engine
12
 
13
- def show(self, navigations: str = None, model_provides: List = None, evaluation_metrics: str = None):
14
- df_result, leaderboards = self.data_engine.jsons_to_df()
 
 
15
 
16
  navigations = "Text" if navigations is None else navigations.split(" ", maxsplit=1)[0]
17
- model_provides = [] if model_provides is None else model_provides
18
  evaluation_metrics = "NDCG@10" if evaluation_metrics is None else evaluation_metrics
 
 
 
 
19
 
20
- df_result = self.data_engine.filter_by_providers(df_result, model_provides)
21
 
22
  sort_col = evaluation_metrics.replace("@", '_at_').lower()
23
-
24
  df_result = df_result.sort_values(by=sort_col, ascending=False)
25
 
26
  items = []
27
- for leaderboard in leaderboards:
28
- with gr.Column(visible=leaderboard["name"] == navigations) as column:
29
  with gr.Tabs():
30
  with gr.TabItem("overall"):
31
- df_leaderboard = df_result[df_result["leaderboard"] == leaderboard["slug"]]
32
  gr_df = gr.Dataframe(
33
  df_leaderboard,
 
34
  interactive=False
35
  )
36
 
37
  items.append(gr_df)
38
 
39
- for task in leaderboard["tasks"]:
40
- with gr.TabItem(task):
41
- df = df_leaderboard[df_leaderboard["task"] == task]
42
  gr_df = gr.Dataframe(
43
  df,
 
44
  interactive=False
45
  )
46
  items.append(gr_df)
 
2
  import gradio as gr
3
  import pandas as pd
4
 
5
+ from app.backend.constant import LEADERBOARD_MAP
6
+ from app.backend.data_engine import DataEngine, COLUMNS_TYPES
7
 
8
 
9
  class SubtabsComponent:
 
11
  def __init__(self, data_engine: DataEngine):
12
  self.data_engine = data_engine
13
 
14
+ def show(self, navigations: str = None, model_provides: List = None, evaluation_metrics: str = None,
15
+ embd_dtypes: str = None, embd_dims: List = None, similarity: str = None, max_tokens: str = None):
16
+
17
+ df_result = self.data_engine.jsons_to_df()
18
 
19
  navigations = "Text" if navigations is None else navigations.split(" ", maxsplit=1)[0]
20
+
21
  evaluation_metrics = "NDCG@10" if evaluation_metrics is None else evaluation_metrics
22
+ embd_dtype = "all" if embd_dtypes is None else embd_dtypes
23
+ embd_dims = [] if embd_dims is None else embd_dims
24
+ similarity = "all" if similarity is None else similarity
25
+ max_tokens = 0 if max_tokens is None else max_tokens
26
 
27
+ df_result = self.data_engine.filter_df(df_result, embd_dtype, embd_dims, similarity, max_tokens)
28
 
29
  sort_col = evaluation_metrics.replace("@", '_at_').lower()
30
+
31
  df_result = df_result.sort_values(by=sort_col, ascending=False)
32
 
33
  items = []
34
+ for leaderboard, group_names in LEADERBOARD_MAP.items():
35
+ with gr.Column(visible=leaderboard.upper() == navigations.upper()) as column:
36
  with gr.Tabs():
37
  with gr.TabItem("overall"):
38
+ df_leaderboard = df_result[df_result["leaderboard"] == leaderboard]
39
  gr_df = gr.Dataframe(
40
  df_leaderboard,
41
+ datatype=COLUMNS_TYPES,
42
  interactive=False
43
  )
44
 
45
  items.append(gr_df)
46
 
47
+ for group_name in group_names:
48
+ with gr.TabItem(group_name):
49
+ df = df_leaderboard[df_leaderboard["group_name"] == group_name]
50
  gr_df = gr.Dataframe(
51
  df,
52
+ datatype=COLUMNS_TYPES,
53
  interactive=False
54
  )
55
  items.append(gr_df)
app/ui/home.py CHANGED
@@ -1,13 +1,7 @@
1
- # -*- coding: utf-8 -*-
2
- # @Date : 2024/12/24 17:20
3
- # @Author : q275343119
4
- # @File : home.py
5
- # @Description: Home page implementation and UI components
6
  import pandas as pd
7
 
8
- from app.backend.constant import Navigation, TaskCategory, ModelProvider, EvaluationMetric
9
  from app.backend.data_engine import DataEngine
10
- from app.ui.component.df_component import DataFrameComponent
11
  from app.ui.component.filter_component import FilterComponent
12
  from app.ui.component.subtabs_component import SubtabsComponent
13
  from app.ui.static import HOME_CSS
@@ -35,9 +29,12 @@ def init_home():
35
  [element.value for element in Navigation],
36
  [element.value for element in ModelProvider],
37
  [element.value for element in EvaluationMetric],
 
 
 
38
  )
39
 
40
- navigations, model_provides, evaluation_metrics = filter_area.show()
41
 
42
  sub_tabs = SubtabsComponent(data_engine)
43
  columns = sub_tabs.show()
@@ -45,39 +42,24 @@ def init_home():
45
  # df_area = DataFrameComponent(data_engine)
46
  # df_display = df_area.show(pd.DataFrame(columns=[element.value for element in Navigation]))
47
 
48
-
49
- gr.Markdown(f"""
50
- - **Total Datasets**: {NUM_DATASETS}
51
- - **Total Languages**: 113
52
- - **Total Scores**: {NUM_SCORES}
53
- - **Total Models**: {NUM_MODELS}
54
- """ + r"""
55
- Made with ❤️ for NLP. If this work is useful to you, please consider citing:
56
-
57
- ```bibtex
58
- @article{muennighoff2022mteb,
59
- doi = {10.48550/ARXIV.2210.07316},
60
- url = {https://arxiv.org/abs/2210.07316},
61
- author = {Muennighoff, Niklas and Tazi, Nouamane and Magne, Lo{\"\i}c and Reimers, Nils},
62
- title = {MTEB: Massive Text Embedding Benchmark},
63
- publisher = {arXiv},
64
- journal={arXiv preprint arXiv:2210.07316},
65
- year = {2022}
66
- }
67
- ```
68
- """)
69
- # all_outputs = list[sub_tab_map.values()]
70
  block.load(sub_tabs.show,
71
- inputs=[navigations, model_provides, evaluation_metrics], outputs=columns)
 
72
 
73
  gr.on(triggers=[navigations.change,
74
  model_provides.change,
75
- evaluation_metrics.change],
76
- inputs=[navigations, model_provides, evaluation_metrics],
 
 
 
 
 
 
77
  fn=sub_tabs.show,
78
- outputs=columns
 
79
  )
80
 
81
-
82
  block.queue(max_size=10)
83
  return block
 
 
 
 
 
 
1
  import pandas as pd
2
 
3
+ from app.backend.constant import Navigation, ModelProvider, EvaluationMetric, EmbdDtype, EmbdDim, Similarity
4
  from app.backend.data_engine import DataEngine
 
5
  from app.ui.component.filter_component import FilterComponent
6
  from app.ui.component.subtabs_component import SubtabsComponent
7
  from app.ui.static import HOME_CSS
 
29
  [element.value for element in Navigation],
30
  [element.value for element in ModelProvider],
31
  [element.value for element in EvaluationMetric],
32
+ [element.value for element in EmbdDtype],
33
+ [element.value for element in EmbdDim],
34
+ [element.value for element in Similarity],
35
  )
36
 
37
+ navigations, model_provides, evaluation_metrics, embd_dtypes, embd_dims, similarities, max_tokens = filter_area.show()
38
 
39
  sub_tabs = SubtabsComponent(data_engine)
40
  columns = sub_tabs.show()
 
42
  # df_area = DataFrameComponent(data_engine)
43
  # df_display = df_area.show(pd.DataFrame(columns=[element.value for element in Navigation]))
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  block.load(sub_tabs.show,
46
+ inputs=[navigations, model_provides, evaluation_metrics, embd_dtypes, embd_dims, similarities,
47
+ max_tokens], outputs=columns)
48
 
49
  gr.on(triggers=[navigations.change,
50
  model_provides.change,
51
+ evaluation_metrics.change,
52
+ embd_dtypes.change,
53
+ embd_dims.change,
54
+ similarities.change,
55
+ max_tokens.change
56
+ ],
57
+ inputs=[navigations, model_provides, evaluation_metrics, embd_dtypes, embd_dims, similarities,
58
+ max_tokens],
59
  fn=sub_tabs.show,
60
+ outputs=columns,
61
+ trigger_mode="once"
62
  )
63
 
 
64
  block.queue(max_size=10)
65
  return block
app/ui/static.py CHANGED
@@ -1,9 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
- # @Date : 2024/12/24 17:16
3
- # @Author : q275343119
4
- # @File : static.py
5
- # @Description:
6
-
7
  HOME_CSS = """
8
  table > thead {
9
  white-space: normal
 
 
 
 
 
 
 
1
  HOME_CSS = """
2
  table > thead {
3
  white-space: normal
mock_data/datasets.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {"group_name": "text", "dataset_names": ["LegalQuAD", "MBPP", "PyTorch1024", "TAT-QA"], "leaderboard": "text"},
3
+ {"group_name": "law", "dataset_names": ["LegalQuAD"], "leaderboard": "text"},
4
+ {"group_name": "multilingual", "dataset_names": ["LegalQuAD"], "leaderboard": "text"},
5
+ {"group_name": "german", "dataset_names": ["LegalQuAD"], "leaderboard": "text"},
6
+ {"group_name": "code", "dataset_names": ["MBPP"], "leaderboard": "text"},
7
+ {"group_name": "tech", "dataset_names": ["PyTorch1024", "TAT-QA"], "leaderboard": "text"},
8
+ {"group_name": "long-context", "dataset_names": ["LongContextData1", "LongContextData2"], "leaderboard": "text"},
9
+ {"group_name": "finance", "dataset_names": ["FinanceData1", "FinanceData2"], "leaderboard": "text"},
10
+ {"group_name": "conversational", "dataset_names": ["ConversationalData1", "ConversationalData2"], "leaderboard": "text"},
11
+ {"group_name": "healthcare", "dataset_names": ["HealthcareData1", "HealthcareData2"], "leaderboard": "text"},
12
+ {"group_name": "multimodal", "dataset_names": ["MultimodalData1", "MultimodalData2"], "leaderboard": "multimodal"},
13
+ {"group_name": "text-to-photo", "dataset_names": ["TextToPhotoData1", "TextToPhotoData2"], "leaderboard": "multimodal"},
14
+ {"group_name": "document-screenshot", "dataset_names": ["DocumentScreenshotData1", "DocumentScreenshotData2"], "leaderboard": "multimodal"},
15
+ {"group_name": "figures-and-tables", "dataset_names": ["FiguresAndTablesData1", "FiguresAndTablesData2"], "leaderboard": "multimodal"},
16
+ {"group_name": "text-to-text", "dataset_names": ["TextToTextData1", "TextToTextData2"], "leaderboard": "multimodal"}
17
+ ]
mock_data/leaderboard.json DELETED
@@ -1,26 +0,0 @@
1
- [
2
- {
3
- "slug": "text",
4
- "name": "Text",
5
- "tasks": [
6
- "law",
7
- "long-context",
8
- "finance",
9
- "conversational",
10
- "tech",
11
- "multilingual",
12
- "code",
13
- "healthcare"
14
- ]
15
- },
16
- {
17
- "slug": "multimodal",
18
- "name": "Multimodal",
19
- "tasks": [
20
- "text-to-photo",
21
- "document-screenshot",
22
- "figures-and-tables",
23
- "text-to-text"
24
- ]
25
- }
26
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
mock_data/models.json CHANGED
@@ -1,400 +1,113 @@
1
  [
 
 
 
 
 
2
 
3
- {
4
- "class": "sentence-transformers",
5
- "organization": "BAAI",
6
- "model_name": "bge-law-transformer",
7
- "leaderboards": [
8
- "text"
9
- ],
10
- "tasks": [
11
- "law"
12
- ]
13
- },
14
- {
15
- "class": "custom",
16
- "organization": "OpenAI",
17
- "model_name": "openai-law-embed-v2",
18
- "leaderboards": [
19
- "text"
20
- ],
21
- "tasks": [
22
- "law"
23
- ]
24
- },
25
- {
26
- "class": "proprietary",
27
- "organization": "Google",
28
- "model_name": "google-law-model-v1",
29
- "leaderboards": [
30
- "text"
31
- ],
32
- "tasks": [
33
- "law"
34
- ]
35
- },
36
- {
37
- "class": "sentence-transformers",
38
- "organization": "HuggingFace",
39
- "model_name": "hf-long-context-transformer",
40
- "leaderboards": [
41
- "text"
42
- ],
43
- "tasks": [
44
- "long-context"
45
- ]
46
- },
47
- {
48
- "class": "custom",
49
- "organization": "Apple",
50
- "model_name": "apple-long-context-embed",
51
- "leaderboards": [
52
- "text"
53
- ],
54
- "tasks": [
55
- "long-context"
56
- ]
57
- },
58
- {
59
- "class": "proprietary",
60
- "organization": "Microsoft",
61
- "model_name": "microsoft-long-context-v1",
62
- "leaderboards": [
63
- "text"
64
- ],
65
- "tasks": [
66
- "long-context"
67
- ]
68
- },
69
- {
70
- "class": "sentence-transformers",
71
- "organization": "HuggingFace",
72
- "model_name": "hf-finance-transformer",
73
- "leaderboards": [
74
- "text"
75
- ],
76
- "tasks": [
77
- "finance"
78
- ]
79
- },
80
- {
81
- "class": "custom",
82
- "organization": "OpenAI",
83
- "model_name": "openai-finance-embed-v1",
84
- "leaderboards": [
85
- "text"
86
- ],
87
- "tasks": [
88
- "finance"
89
- ]
90
- },
91
- {
92
- "class": "proprietary",
93
- "organization": "Google",
94
- "model_name": "google-finance-embed-v1",
95
- "leaderboards": [
96
- "text"
97
- ],
98
- "tasks": [
99
- "finance"
100
- ]
101
- },
102
- {
103
- "class": "custom",
104
- "organization": "Microsoft",
105
- "model_name": "microsoft-conversational-v2",
106
- "leaderboards": [
107
- "text"
108
- ],
109
- "tasks": [
110
- "conversational"
111
- ]
112
- },
113
- {
114
- "class": "sentence-transformers",
115
- "organization": "Facebook",
116
- "model_name": "fb-conversational-embed",
117
- "leaderboards": [
118
- "text"
119
- ],
120
- "tasks": [
121
- "conversational"
122
- ]
123
- },
124
- {
125
- "class": "proprietary",
126
- "organization": "Amazon",
127
- "model_name": "amazon-conversational-transformer",
128
- "leaderboards": [
129
- "text"
130
- ],
131
- "tasks": [
132
- "conversational"
133
- ]
134
- },
135
- {
136
- "class": "sentence-transformers",
137
- "organization": "Tesla",
138
- "model_name": "tesla-tech-model",
139
- "leaderboards": [
140
- "text"
141
- ],
142
- "tasks": [
143
- "tech"
144
- ]
145
- },
146
- {
147
- "class": "custom",
148
- "organization": "Snowflake",
149
- "model_name": "snowflake-tech-embed",
150
- "leaderboards": [
151
- "text"
152
- ],
153
- "tasks": [
154
- "tech"
155
- ]
156
- },
157
- {
158
- "class": "proprietary",
159
- "organization": "DeepMind",
160
- "model_name": "dm-tech-v1",
161
- "leaderboards": [
162
- "text"
163
- ],
164
- "tasks": [
165
- "tech"
166
- ]
167
- },
168
- {
169
- "class": "sentence-transformers",
170
- "organization": "Tesla",
171
- "model_name": "tesla-multilingual",
172
- "leaderboards": [
173
- "text"
174
- ],
175
- "tasks": [
176
- "multilingual"
177
- ]
178
- },
179
- {
180
- "class": "custom",
181
- "organization": "Apple",
182
- "model_name": "apple-multilingual-embed",
183
- "leaderboards": [
184
- "text"
185
- ],
186
- "tasks": [
187
- "multilingual"
188
- ]
189
- },
190
- {
191
- "class": "proprietary",
192
- "organization": "Google",
193
- "model_name": "google-multilingual-model",
194
- "leaderboards": [
195
- "text"
196
- ],
197
- "tasks": [
198
- "multilingual"
199
- ]
200
- },
201
- {
202
- "class": "custom",
203
- "organization": "Microsoft",
204
- "model_name": "microsoft-code-embed",
205
- "leaderboards": [
206
- "text"
207
- ],
208
- "tasks": [
209
- "code"
210
- ]
211
- },
212
- {
213
- "class": "sentence-transformers",
214
- "organization": "HuggingFace",
215
- "model_name": "hf-code-transformer",
216
- "leaderboards": [
217
- "text"
218
- ],
219
- "tasks": [
220
- "code"
221
- ]
222
- },
223
- {
224
- "class": "proprietary",
225
- "organization": "Apple",
226
- "model_name": "apple-code-model",
227
- "leaderboards": [
228
- "text"
229
- ],
230
- "tasks": [
231
- "code"
232
- ]
233
- },
234
- {
235
- "class": "custom",
236
- "organization": "Microsoft",
237
- "model_name": "microsoft-healthcare-v2",
238
- "leaderboards": [
239
- "text"
240
- ],
241
- "tasks": [
242
- "healthcare"
243
- ]
244
- },
245
- {
246
- "class": "sentence-transformers",
247
- "organization": "Facebook",
248
- "model_name": "fb-healthcare-embed",
249
- "leaderboards": [
250
- "text"
251
- ],
252
- "tasks": [
253
- "healthcare"
254
- ]
255
- },
256
- {
257
- "class": "proprietary",
258
- "organization": "Google",
259
- "model_name": "google-healthcare-model",
260
- "leaderboards": [
261
- "text"
262
- ],
263
- "tasks": [
264
- "healthcare"
265
- ]
266
- },
267
-
268
- {
269
- "class": "sentence-transformers",
270
- "organization": "Facebook",
271
- "model_name": "fb-text-to-photo",
272
- "leaderboards": [
273
- "multimodal"
274
- ],
275
- "tasks": [
276
- "text-to-photo"
277
- ]
278
- },
279
- {
280
- "class": "proprietary",
281
- "organization": "Apple",
282
- "model_name": "apple-text-to-photo-v2",
283
- "leaderboards": [
284
- "multimodal"
285
- ],
286
- "tasks": [
287
- "text-to-photo"
288
- ]
289
- },
290
- {
291
- "class": "custom",
292
- "organization": "Microsoft",
293
- "model_name": "microsoft-text-to-photo",
294
- "leaderboards": [
295
- "multimodal"
296
- ],
297
- "tasks": [
298
- "text-to-photo"
299
- ]
300
- },
301
- {
302
- "class": "custom",
303
- "organization": "Microsoft",
304
- "model_name": "microsoft-document-screenshot",
305
- "leaderboards": [
306
- "multimodal"
307
- ],
308
- "tasks": [
309
- "document-screenshot"
310
- ]
311
- },
312
- {
313
- "class": "sentence-transformers",
314
- "organization": "Google",
315
- "model_name": "google-document-screenshot",
316
- "leaderboards": [
317
- "multimodal"
318
- ],
319
- "tasks": [
320
- "document-screenshot"
321
- ]
322
- },
323
- {
324
- "class": "proprietary",
325
- "organization": "Facebook",
326
- "model_name": "fb-document-screenshot",
327
- "leaderboards": [
328
- "multimodal"
329
- ],
330
- "tasks": [
331
- "document-screenshot"
332
- ]
333
- },
334
- {
335
- "class": "sentence-transformers",
336
- "organization": "Google",
337
- "model_name": "google-figures-tables",
338
- "leaderboards": [
339
- "multimodal"
340
- ],
341
- "tasks": [
342
- "figures-and-tables"
343
- ]
344
- },
345
- {
346
- "class": "custom",
347
- "organization": "Microsoft",
348
- "model_name": "microsoft-figures-tables",
349
- "leaderboards": [
350
- "multimodal"
351
- ],
352
- "tasks": [
353
- "figures-and-tables"
354
- ]
355
- },
356
- {
357
- "class": "proprietary",
358
- "organization": "Apple",
359
- "model_name": "apple-figures-tables",
360
- "leaderboards": [
361
- "multimodal"
362
- ],
363
- "tasks": [
364
- "figures-and-tables"
365
- ]
366
- },
367
- {
368
- "class": "sentence-transformers",
369
- "organization": "OpenAI",
370
- "model_name": "openai-text-to-text",
371
- "leaderboards": [
372
- "multimodal"
373
- ],
374
- "tasks": [
375
- "text-to-text"
376
- ]
377
- },
378
- {
379
- "class": "proprietary",
380
- "organization": "Facebook",
381
- "model_name": "fb-text-to-text",
382
- "leaderboards": [
383
- "multimodal"
384
- ],
385
- "tasks": [
386
- "text-to-text"
387
- ]
388
- },
389
- {
390
- "class": "custom",
391
- "organization": "Apple",
392
- "model_name": "apple-text-to-text",
393
- "leaderboards": [
394
- "multimodal"
395
- ],
396
- "tasks": [
397
- "text-to-text"
398
- ]
399
- }
400
- ]
 
1
  [
2
+ {"model_name":"sentence-transformers/all-MiniLM-L6-v2","embd_dtype":"float32","embd_dim":384,"num_params":22700000,"max_tokens":256,
3
+ "similarity":"cosine","query_instruct":null,"corpus_instruct":null,
4
+ "reference":"https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2"},
5
+ {"model_name":"jinaai/jina-embeddings-v2-small-en","embd_dtype":"float32","embd_dim":512,"num_params":32700000,"max_tokens":8192,
6
+ "similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://huggingface.co/jinaai/jina-embeddings-v2-small-en"},
7
 
8
+ {"model_name":"text-embedding-3-small","embd_dtype":"float32","embd_dim":1536,"num_params":null,"max_tokens":8191,
9
+ "similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://docs.voyageai.com/docs/embeddings"},
10
+ {"model_name":"voyage-3-lite","embd_dtype":"float32","embd_dim":512,"num_params":null,"max_tokens":32000,"similarity":"cosine",
11
+ "query_instruct":"Represent the query for retrieving supporting documents: ","corpus_instruct":"Represent the document for retrieval: ",
12
+ "reference":"https://docs.voyageai.com/docs/embeddings"},
13
+ {"model_name":"mock-model-1","embd_dtype":"float32","embd_dim":512,"num_params":5000000,"max_tokens":1024,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-1"},
14
+ {"model_name":"mock-model-2","embd_dtype":"int8","embd_dim":256,"num_params":10000000,"max_tokens":2048,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-2"},
15
+ {"model_name":"mock-model-3","embd_dtype":"binary","embd_dim":1024,"num_params":2000000,"max_tokens":4096,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-3"},
16
+ {"model_name":"mock-model-4","embd_dtype":"float32","embd_dim":768,"num_params":3000000,"max_tokens":512,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-4"},
17
+ {"model_name":"mock-model-5","embd_dtype":"int8","embd_dim":384,"num_params":7000000,"max_tokens":8192,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-5"},
18
+ {"model_name":"mock-model-6","embd_dtype":"binary","embd_dim":640,"num_params":15000000,"max_tokens":16384,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-6"},
19
+ {"model_name":"mock-model-7","embd_dtype":"float32","embd_dim":512,"num_params":2500000,"max_tokens":256,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-7"},
20
+ {"model_name":"mock-model-8","embd_dtype":"int8","embd_dim":1024,"num_params":8000000,"max_tokens":32000,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-8"},
21
+ {"model_name":"mock-model-9","embd_dtype":"binary","embd_dim":128,"num_params":9000000,"max_tokens":8191,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-9"},
22
+ {"model_name":"mock-model-10","embd_dtype":"float32","embd_dim":1536,"num_params":6000000,"max_tokens":4096,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-10"},
23
+ {"model_name":"mock-model-11","embd_dtype":"int8","embd_dim":512,"num_params":11000000,"max_tokens":1024,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-11"},
24
+ {"model_name":"mock-model-12","embd_dtype":"binary","embd_dim":256,"num_params":12000000,"max_tokens":2048,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-12"},
25
+ {"model_name":"mock-model-13","embd_dtype":"float32","embd_dim":1024,"num_params":13000000,"max_tokens":512,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-13"},
26
+ {"model_name":"mock-model-14","embd_dtype":"int8","embd_dim":768,"num_params":14000000,"max_tokens":16384,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-14"},
27
+ {"model_name":"mock-model-15","embd_dtype":"binary","embd_dim":384,"num_params":15000000,"max_tokens":32000,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-15"},
28
+ {"model_name":"mock-model-16","embd_dtype":"float32","embd_dim":640,"num_params":16000000,"max_tokens":256,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-16"},
29
+ {"model_name":"mock-model-17","embd_dtype":"int8","embd_dim":512,"num_params":17000000,"max_tokens":8192,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-17"},
30
+ {"model_name":"mock-model-18","embd_dtype":"binary","embd_dim":1024,"num_params":18000000,"max_tokens":4096,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-18"},
31
+ {"model_name":"mock-model-19","embd_dtype":"float32","embd_dim":128,"num_params":19000000,"max_tokens":1024,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-19"},
32
+ {"model_name":"mock-model-20","embd_dtype":"int8","embd_dim":1536,"num_params":20000000,"max_tokens":2048,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-20"},
33
+ {"model_name":"mock-model-21","embd_dtype":"binary","embd_dim":512,"num_params":21000000,"max_tokens":512,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-21"},
34
+ {"model_name":"mock-model-22","embd_dtype":"float32","embd_dim":256,"num_params":22000000,"max_tokens":16384,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-22"},
35
+ {"model_name":"mock-model-23","embd_dtype":"int8","embd_dim":1024,"num_params":23000000,"max_tokens":32000,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-23"},
36
+ {"model_name":"mock-model-24","embd_dtype":"binary","embd_dim":768,"num_params":24000000,"max_tokens":8191,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-24"},
37
+ {"model_name":"mock-model-25","embd_dtype":"float32","embd_dim":384,"num_params":25000000,"max_tokens":4096,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-25"},
38
+ {"model_name":"mock-model-26","embd_dtype":"int8","embd_dim":640,"num_params":26000000,"max_tokens":1024,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-26"},
39
+ {"model_name":"mock-model-27","embd_dtype":"binary","embd_dim":512,"num_params":27000000,"max_tokens":2048,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-27"},
40
+ {"model_name":"mock-model-28","embd_dtype":"float32","embd_dim":1024,"num_params":28000000,"max_tokens":512,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-28"},
41
+ {"model_name":"mock-model-29","embd_dtype":"int8","embd_dim":128,"num_params":29000000,"max_tokens":16384,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-29"},
42
+ {"model_name":"mock-model-30","embd_dtype":"binary","embd_dim":1536,"num_params":30000000,"max_tokens":32000,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-30"},
43
+ {"model_name":"mock-model-31","embd_dtype":"float32","embd_dim":512,"num_params":31000000,"max_tokens":256,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-31"},
44
+ {"model_name":"mock-model-32","embd_dtype":"int8","embd_dim":256,"num_params":32000000,"max_tokens":8192,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-32"},
45
+ {"model_name":"mock-model-33","embd_dtype":"binary","embd_dim":1024,"num_params":33000000,"max_tokens":4096,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-33"},
46
+ {"model_name":"mock-model-34","embd_dtype":"float32","embd_dim":768,"num_params":34000000,"max_tokens":1024,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-34"},
47
+ {"model_name":"mock-model-35","embd_dtype":"int8","embd_dim":384,"num_params":35000000,"max_tokens":2048,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-35"},
48
+ {"model_name":"mock-model-36","embd_dtype":"binary","embd_dim":640,"num_params":36000000,"max_tokens":512,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-36"},
49
+ {"model_name":"mock-model-37","embd_dtype":"float32","embd_dim":512,"num_params":37000000,"max_tokens":16384,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-37"},
50
+ {"model_name":"mock-model-38","embd_dtype":"int8","embd_dim":1024,"num_params":38000000,"max_tokens":32000,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-38"},
51
+ {"model_name":"mock-model-39","embd_dtype":"binary","embd_dim":128,"num_params":39000000,"max_tokens":8191,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-39"},
52
+ {"model_name":"mock-model-40","embd_dtype":"float32","embd_dim":1536,"num_params":40000000,"max_tokens":4096,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-40"},
53
+ {"model_name":"mock-model-41","embd_dtype":"int8","embd_dim":512,"num_params":41000000,"max_tokens":1024,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-41"},
54
+ {"model_name":"mock-model-42","embd_dtype":"binary","embd_dim":256,"num_params":42000000,"max_tokens":2048,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-42"},
55
+ {"model_name":"mock-model-43","embd_dtype":"float32","embd_dim":1024,"num_params":43000000,"max_tokens":512,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-43"},
56
+ {"model_name":"mock-model-44","embd_dtype":"int8","embd_dim":768,"num_params":44000000,"max_tokens":16384,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-44"},
57
+ {"model_name":"mock-model-45","embd_dtype":"binary","embd_dim":384,"num_params":45000000,"max_tokens":32000,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-45"},
58
+ {"model_name":"mock-model-46","embd_dtype":"float32","embd_dim":640,"num_params":46000000,"max_tokens":256,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-46"},
59
+ {"model_name":"mock-model-47","embd_dtype":"int8","embd_dim":512,"num_params":47000000,"max_tokens":8192,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-47"},
60
+ {"model_name":"mock-model-48","embd_dtype":"binary","embd_dim":1024,"num_params":48000000,"max_tokens":4096,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-48"},
61
+ {"model_name":"mock-model-49","embd_dtype":"float32","embd_dim":128,"num_params":49000000,"max_tokens":1024,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-49"},
62
+ {"model_name":"mock-model-50","embd_dtype":"int8","embd_dim":1536,"num_params":50000000,"max_tokens":2048,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-50"},
63
+ {"model_name":"mock-model-51","embd_dtype":"binary","embd_dim":512,"num_params":51000000,"max_tokens":512,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-51"},
64
+ {"model_name":"mock-model-52","embd_dtype":"float32","embd_dim":256,"num_params":52000000,"max_tokens":16384,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-52"},
65
+ {"model_name":"mock-model-53","embd_dtype":"int8","embd_dim":1024,"num_params":53000000,"max_tokens":32000,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-53"},
66
+ {"model_name":"mock-model-54","embd_dtype":"binary","embd_dim":768,"num_params":54000000,"max_tokens":8191,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-54"},
67
+ {"model_name":"mock-model-55","embd_dtype":"float32","embd_dim":384,"num_params":55000000,"max_tokens":4096,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-55"},
68
+ {"model_name":"mock-model-56","embd_dtype":"int8","embd_dim":640,"num_params":56000000,"max_tokens":1024,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-56"},
69
+ {"model_name":"mock-model-57","embd_dtype":"binary","embd_dim":512,"num_params":57000000,"max_tokens":2048,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-57"},
70
+ {"model_name":"mock-model-58","embd_dtype":"float32","embd_dim":1024,"num_params":58000000,"max_tokens":512,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-58"},
71
+ {"model_name":"mock-model-59","embd_dtype":"int8","embd_dim":128,"num_params":59000000,"max_tokens":16384,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-59"},
72
+ {"model_name":"mock-model-60","embd_dtype":"binary","embd_dim":1536,"num_params":60000000,"max_tokens":32000,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-60"},
73
+ {"model_name":"mock-model-61","embd_dtype":"float32","embd_dim":512,"num_params":61000000,"max_tokens":256,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-61"},
74
+ {"model_name":"mock-model-62","embd_dtype":"int8","embd_dim":256,"num_params":62000000,"max_tokens":8192,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-62"},
75
+ {"model_name":"mock-model-63","embd_dtype":"binary","embd_dim":1024,"num_params":63000000,"max_tokens":4096,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-63"},
76
+ {"model_name":"mock-model-64","embd_dtype":"float32","embd_dim":768,"num_params":64000000,"max_tokens":1024,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-64"},
77
+ {"model_name":"mock-model-65","embd_dtype":"int8","embd_dim":384,"num_params":65000000,"max_tokens":2048,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-65"},
78
+ {"model_name":"mock-model-66","embd_dtype":"binary","embd_dim":640,"num_params":66000000,"max_tokens":512,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-66"},
79
+ {"model_name":"mock-model-67","embd_dtype":"float32","embd_dim":512,"num_params":67000000,"max_tokens":16384,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-67"},
80
+ {"model_name":"mock-model-68","embd_dtype":"int8","embd_dim":1024,"num_params":68000000,"max_tokens":32000,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-68"},
81
+ {"model_name":"mock-model-69","embd_dtype":"binary","embd_dim":128,"num_params":69000000,"max_tokens":8191,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-69"},
82
+ {"model_name":"mock-model-70","embd_dtype":"float32","embd_dim":1536,"num_params":70000000,"max_tokens":4096,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-70"},
83
+ {"model_name":"mock-model-71","embd_dtype":"int8","embd_dim":512,"num_params":71000000,"max_tokens":1024,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-71"},
84
+ {"model_name":"mock-model-72","embd_dtype":"binary","embd_dim":256,"num_params":72000000,"max_tokens":2048,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-72"},
85
+ {"model_name":"mock-model-73","embd_dtype":"float32","embd_dim":1024,"num_params":73000000,"max_tokens":512,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-73"},
86
+ {"model_name":"mock-model-74","embd_dtype":"int8","embd_dim":768,"num_params":74000000,"max_tokens":16384,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-74"},
87
+ {"model_name":"mock-model-75","embd_dtype":"binary","embd_dim":384,"num_params":75000000,"max_tokens":32000,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-75"},
88
+ {"model_name":"mock-model-76","embd_dtype":"float32","embd_dim":640,"num_params":76000000,"max_tokens":256,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-76"},
89
+ {"model_name":"mock-model-77","embd_dtype":"int8","embd_dim":512,"num_params":77000000,"max_tokens":8192,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-77"},
90
+ {"model_name":"mock-model-78","embd_dtype":"binary","embd_dim":1024,"num_params":78000000,"max_tokens":4096,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-78"},
91
+ {"model_name":"mock-model-79","embd_dtype":"float32","embd_dim":128,"num_params":79000000,"max_tokens":1024,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-79"},
92
+ {"model_name":"mock-model-80","embd_dtype":"int8","embd_dim":1536,"num_params":80000000,"max_tokens":2048,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-80"},
93
+ {"model_name":"mock-model-81","embd_dtype":"binary","embd_dim":512,"num_params":81000000,"max_tokens":512,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-81"},
94
+ {"model_name":"mock-model-82","embd_dtype":"float32","embd_dim":256,"num_params":82000000,"max_tokens":16384,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-82"},
95
+ {"model_name":"mock-model-83","embd_dtype":"int8","embd_dim":1024,"num_params":83000000,"max_tokens":32000,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-83"},
96
+ {"model_name":"mock-model-84","embd_dtype":"binary","embd_dim":768,"num_params":84000000,"max_tokens":8191,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-84"},
97
+ {"model_name":"mock-model-85","embd_dtype":"float32","embd_dim":384,"num_params":85000000,"max_tokens":4096,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-85"},
98
+ {"model_name":"mock-model-86","embd_dtype":"int8","embd_dim":640,"num_params":86000000,"max_tokens":1024,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-86"},
99
+ {"model_name":"mock-model-87","embd_dtype":"binary","embd_dim":512,"num_params":87000000,"max_tokens":2048,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-87"},
100
+ {"model_name":"mock-model-88","embd_dtype":"float32","embd_dim":1024,"num_params":88000000,"max_tokens":512,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-88"},
101
+ {"model_name":"mock-model-89","embd_dtype":"int8","embd_dim":128,"num_params":89000000,"max_tokens":16384,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-89"},
102
+ {"model_name":"mock-model-90","embd_dtype":"binary","embd_dim":1536,"num_params":90000000,"max_tokens":32000,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-90"},
103
+ {"model_name":"mock-model-91","embd_dtype":"float32","embd_dim":512,"num_params":91000000,"max_tokens":256,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-91"},
104
+ {"model_name":"mock-model-92","embd_dtype":"int8","embd_dim":256,"num_params":92000000,"max_tokens":8192,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-92"},
105
+ {"model_name":"mock-model-93","embd_dtype":"binary","embd_dim":1024,"num_params":93000000,"max_tokens":4096,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-93"},
106
+ {"model_name":"mock-model-94","embd_dtype":"float32","embd_dim":768,"num_params":94000000,"max_tokens":1024,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-94"},
107
+ {"model_name":"mock-model-95","embd_dtype":"int8","embd_dim":384,"num_params":95000000,"max_tokens":2048,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-95"},
108
+ {"model_name":"mock-model-96","embd_dtype":"binary","embd_dim":640,"num_params":96000000,"max_tokens":512,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-96"},
109
+ {"model_name":"mock-model-97","embd_dtype":"float32","embd_dim":512,"num_params":97000000,"max_tokens":16384,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-97"},
110
+ {"model_name":"mock-model-98","embd_dtype":"int8","embd_dim":1024,"num_params":98000000,"max_tokens":32000,"similarity":"dot","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-98"},
111
+ {"model_name":"mock-model-99","embd_dtype":"binary","embd_dim":128,"num_params":99000000,"max_tokens":8191,"similarity":"euclidean","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-99"},
112
+ {"model_name":"mock-model-100","embd_dtype":"float32","embd_dim":1536,"num_params":100000000,"max_tokens":4096,"similarity":"cosine","query_instruct":null,"corpus_instruct":null,"reference":"https://example.com/mock-model-100"}
113
+ ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
mock_data/results.json CHANGED
The diff for this file is too large to render. See raw diff
 
mock_data/tasks.json DELETED
@@ -1,110 +0,0 @@
1
- [
2
- {
3
- "slug": "law",
4
- "name": "Law",
5
- "datasets": [
6
- "ALIA_casedocs",
7
- "LegalTexts",
8
- "CaseLaw"
9
- ]
10
- },
11
- {
12
- "slug": "finance",
13
- "name": "Finance",
14
- "datasets": [
15
- "FinancialStatements",
16
- "StockMarketData",
17
- "BankingRecords"
18
- ]
19
- },
20
- {
21
- "slug": "healthcare",
22
- "name": "Healthcare",
23
- "datasets": [
24
- "PatientRecords",
25
- "MedicalImages",
26
- "ClinicalTrials"
27
- ]
28
- },
29
- {
30
- "slug": "tech",
31
- "name": "Technology",
32
- "datasets": [
33
- "TechBlogs",
34
- "DeviceSpecifications",
35
- "SoftwareDocumentation"
36
- ]
37
- },
38
- {
39
- "slug": "conversational",
40
- "name": "Conversational",
41
- "datasets": [
42
- "ChatLogs",
43
- "CustomerServiceInteractions",
44
- "ForumPosts"
45
- ]
46
- },
47
- {
48
- "slug": "code",
49
- "name": "Code",
50
- "datasets": [
51
- "GitHubRepositories",
52
- "CodeSnippets",
53
- "ProgrammingQuestions"
54
- ]
55
- },
56
- {
57
- "slug": "multilingual",
58
- "name": "Multilingual",
59
- "datasets": [
60
- "ParallelCorpora",
61
- "TranslationDatasets",
62
- "MultilingualText"
63
- ]
64
- },
65
- {
66
- "slug": "long-context",
67
- "name": "Long Context",
68
- "datasets": [
69
- "ResearchPapers",
70
- "Books",
71
- "LegalDocuments"
72
- ]
73
- },
74
- {
75
- "slug": "text-to-photo",
76
- "name": "Text to Photo",
77
- "datasets": [
78
- "TextPhotoPairs",
79
- "ImageCaptions",
80
- "VisualDescriptions"
81
- ]
82
- },
83
- {
84
- "slug": "document-screenshot",
85
- "name": "Document Screenshot",
86
- "datasets": [
87
- "ScannedDocuments",
88
- "PDFScreenshots",
89
- "DigitalForms"
90
- ]
91
- },
92
- {
93
- "slug": "figures-and-tables",
94
- "name": "Figures and Tables",
95
- "datasets": [
96
- "ScientificFigures",
97
- "DataTables",
98
- "ChartsAndGraphs"
99
- ]
100
- },
101
- {
102
- "slug": "text-to-text",
103
- "name": "Text to Text",
104
- "datasets": [
105
- "ParaphraseDatasets",
106
- "SummarizationDatasets",
107
- "TextRewriting"
108
- ]
109
- }
110
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
requirements.txt CHANGED
@@ -1,3 +1,4 @@
1
- gradio==4.20.0
2
  uvicorn>=0.14.0
3
- fastapi<0.113.0
 
 
1
+ gradio==4.44.1
2
  uvicorn>=0.14.0
3
+ fastapi<0.113.0
4
+ cachetools==5.5.0
utils/cache_decorator.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # @Date : 2025/1/10 10:06
3
+ # @Author : q275343119
4
+ # @File : cache_decorator.py
5
+ # @Description:
6
+ from cachetools import TTLCache
7
+ from functools import wraps
8
+
9
+ CACHE = TTLCache(maxsize=5, ttl=3600)
10
+
11
+
12
+ def cache_with_custom_key(cache_key: str):
13
+ def decorator(func):
14
+ @wraps(func)
15
+ def wrapper(*args, **kwargs):
16
+ if cache_key in CACHE:
17
+ return CACHE[cache_key]
18
+
19
+ result = func(*args, **kwargs)
20
+ CACHE[cache_key] = result
21
+ return result
22
+
23
+ return wrapper
24
+
25
+ return decorator