Spaces:
No application file
No application file
smile
commited on
Commit
·
7e055ad
1
Parent(s):
e7d518b
test build
Browse files- app.py +57 -11
- app/backend/constant.py +3 -2
- app/backend/data_engine.py +63 -12
- app/static/css/style.css +516 -0
- app/static/js/main.js +258 -0
- app/templates/index.html +175 -0
- app/ui/component/subtabs_component.py +6 -6
- mock_data/datasets.json +0 -17
- mock_data/models.json +0 -113
- mock_data/results.json +0 -0
- requirements.txt +4 -0
- utils/cache_decorator.py +21 -0
- utils/http_utils.py +7 -0
app.py
CHANGED
@@ -1,14 +1,60 @@
|
|
1 |
-
from
|
2 |
-
from
|
|
|
|
|
|
|
|
|
3 |
|
4 |
-
import
|
|
|
5 |
|
6 |
-
|
7 |
-
about = init_about()
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
)
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import FastAPI, Request
|
2 |
+
from fastapi.templating import Jinja2Templates
|
3 |
+
from fastapi.staticfiles import StaticFiles
|
4 |
+
from fastapi.responses import HTMLResponse
|
5 |
+
import pandas as pd
|
6 |
+
from pathlib import Path
|
7 |
|
8 |
+
from app.backend.constant import Navigation, ModelProvider, EvaluationMetric, EmbdDtype, EmbdDim, Similarity
|
9 |
+
from app.backend.data_engine import DataEngine
|
10 |
|
11 |
+
app = FastAPI()
|
|
|
12 |
|
13 |
+
# Mount static files
|
14 |
+
app.mount("/static", StaticFiles(directory="app/static"), name="static")
|
15 |
+
|
16 |
+
# Templates
|
17 |
+
templates = Jinja2Templates(directory="app/templates")
|
18 |
+
|
19 |
+
# Initialize data engine
|
20 |
+
data_engine = DataEngine()
|
21 |
+
|
22 |
+
@app.get("/", response_class=HTMLResponse)
|
23 |
+
async def home(request: Request, tab: str = "text"):
|
24 |
+
# Get initial data based on tab
|
25 |
+
if tab == "multimodal":
|
26 |
+
data = data_engine.get_filtered_data(navigation="multimodal")
|
27 |
+
else:
|
28 |
+
data = data_engine.get_data()
|
29 |
+
|
30 |
+
# Convert data to list for template rendering
|
31 |
+
data_list = data.values.tolist()
|
32 |
+
columns = data.columns.tolist()
|
33 |
+
|
34 |
+
return templates.TemplateResponse("index.html", {
|
35 |
+
"request": request,
|
36 |
+
"active_tab": tab,
|
37 |
+
"data": data_list,
|
38 |
+
"columns": columns,
|
39 |
+
"navigations": [e.value for e in Navigation],
|
40 |
+
"embd_types": [e.value for e in EmbdDtype],
|
41 |
+
"embd_dims": [e.value for e in EmbdDim],
|
42 |
+
"similarities": [e.value for e in Similarity]
|
43 |
+
})
|
44 |
+
|
45 |
+
@app.post("/api/filter")
|
46 |
+
async def filter_data(filters: dict):
|
47 |
+
# Apply filters to data
|
48 |
+
data = data_engine.get_filtered_data(
|
49 |
+
navigation=filters.get('navigation'),
|
50 |
+
embd_type=filters.get('embd_type'),
|
51 |
+
embd_dims=filters.get('embd_dims'),
|
52 |
+
similarity=filters.get('similarity')
|
53 |
+
)
|
54 |
+
|
55 |
+
# Convert to list for JSON response
|
56 |
+
return data.values.tolist()
|
57 |
+
|
58 |
+
|
59 |
+
import uvicorn
|
60 |
+
uvicorn.run(app, host="0.0.0.0", port=7890)
|
app/backend/constant.py
CHANGED
@@ -68,7 +68,8 @@ class Similarity(Enum):
|
|
68 |
|
69 |
|
70 |
LEADERBOARD_MAP = {
|
71 |
-
"
|
|
|
72 |
"law",
|
73 |
"long-context",
|
74 |
"finance",
|
@@ -78,7 +79,7 @@ LEADERBOARD_MAP = {
|
|
78 |
"code",
|
79 |
"healthcare"
|
80 |
],
|
81 |
-
"
|
82 |
"text-to-photo",
|
83 |
"document-screenshot",
|
84 |
"figures-and-tables",
|
|
|
68 |
|
69 |
|
70 |
LEADERBOARD_MAP = {
|
71 |
+
"Text": [
|
72 |
+
"text",
|
73 |
"law",
|
74 |
"long-context",
|
75 |
"finance",
|
|
|
79 |
"code",
|
80 |
"healthcare"
|
81 |
],
|
82 |
+
"Multimodal": [
|
83 |
"text-to-photo",
|
84 |
"document-screenshot",
|
85 |
"figures-and-tables",
|
app/backend/data_engine.py
CHANGED
@@ -7,7 +7,8 @@ from typing import List
|
|
7 |
import pandas as pd
|
8 |
|
9 |
from app.backend.constant import ModelProvider
|
10 |
-
from utils.cache_decorator import cache_df_with_custom_key
|
|
|
11 |
|
12 |
COLUMNS = ['model_name', 'group_name', 'leaderboard', 'dataset_name',
|
13 |
'embd_dtype', 'embd_dim', 'num_params', 'max_tokens', 'similarity',
|
@@ -29,6 +30,11 @@ COLUMNS_TYPES = ["markdown", "str", 'str', 'str',
|
|
29 |
'number', 'number', 'number',
|
30 |
'number']
|
31 |
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
class DataEngine:
|
34 |
|
@@ -36,35 +42,78 @@ class DataEngine:
|
|
36 |
self.df = self.init_dataframe()
|
37 |
|
38 |
@property
|
|
|
39 |
def models(self):
|
40 |
"""
|
41 |
Get models data
|
42 |
"""
|
43 |
-
|
44 |
-
|
|
|
|
|
45 |
|
46 |
@property
|
|
|
47 |
def datasets(self):
|
48 |
"""
|
49 |
Get tasks data
|
50 |
"""
|
51 |
-
|
52 |
-
|
|
|
|
|
53 |
|
54 |
@property
|
|
|
55 |
def results(self):
|
56 |
"""
|
57 |
Get results data
|
58 |
"""
|
59 |
-
|
60 |
-
|
|
|
|
|
61 |
|
62 |
def init_dataframe(self):
|
63 |
"""
|
64 |
Initialize DataFrame
|
65 |
"""
|
66 |
-
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
def _check_providers(self, organization: str, providers: List):
|
70 |
if not providers:
|
@@ -89,10 +138,10 @@ class DataEngine:
|
|
89 |
|
90 |
df_datasets_list = []
|
91 |
for item in self.datasets:
|
92 |
-
dataset_names = item["
|
93 |
df_dataset_row = pd.DataFrame(
|
94 |
{
|
95 |
-
"group_name": [item["
|
96 |
"dataset_name": dataset_names,
|
97 |
"leaderboard": [item["leaderboard"] for _ in range(len(dataset_names))]
|
98 |
}
|
@@ -104,12 +153,14 @@ class DataEngine:
|
|
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):
|
|
|
7 |
import pandas as pd
|
8 |
|
9 |
from app.backend.constant import ModelProvider
|
10 |
+
from utils.cache_decorator import cache_df_with_custom_key, cache_dict_with_custom_key
|
11 |
+
from utils.http_utils import get
|
12 |
|
13 |
COLUMNS = ['model_name', 'group_name', 'leaderboard', 'dataset_name',
|
14 |
'embd_dtype', 'embd_dim', 'num_params', 'max_tokens', 'similarity',
|
|
|
30 |
'number', 'number', 'number',
|
31 |
'number']
|
32 |
|
33 |
+
GIT_URL = "https://raw.githubusercontent.com/embedding-benchmark/ebr/refs/heads/main/results/"
|
34 |
+
DATASET_URL = f"{GIT_URL}datasets.json"
|
35 |
+
MODEL_URL = f"{GIT_URL}models.json"
|
36 |
+
RESULT_URL = f"{GIT_URL}results.json"
|
37 |
+
|
38 |
|
39 |
class DataEngine:
|
40 |
|
|
|
42 |
self.df = self.init_dataframe()
|
43 |
|
44 |
@property
|
45 |
+
@cache_dict_with_custom_key("models")
|
46 |
def models(self):
|
47 |
"""
|
48 |
Get models data
|
49 |
"""
|
50 |
+
res = get(MODEL_URL)
|
51 |
+
if res.status_code == 200:
|
52 |
+
return res.json()
|
53 |
+
return {}
|
54 |
|
55 |
@property
|
56 |
+
@cache_dict_with_custom_key("datasets")
|
57 |
def datasets(self):
|
58 |
"""
|
59 |
Get tasks data
|
60 |
"""
|
61 |
+
res = get(DATASET_URL)
|
62 |
+
if res.status_code == 200:
|
63 |
+
return res.json()
|
64 |
+
return {}
|
65 |
|
66 |
@property
|
67 |
+
@cache_dict_with_custom_key("results")
|
68 |
def results(self):
|
69 |
"""
|
70 |
Get results data
|
71 |
"""
|
72 |
+
res = get(RESULT_URL)
|
73 |
+
if res.status_code == 200:
|
74 |
+
return res.json()
|
75 |
+
return {}
|
76 |
|
77 |
def init_dataframe(self):
|
78 |
"""
|
79 |
Initialize DataFrame
|
80 |
"""
|
81 |
+
return self.jsons_to_df()
|
82 |
+
|
83 |
+
def get_data(self):
|
84 |
+
"""
|
85 |
+
Get the full dataset
|
86 |
+
"""
|
87 |
+
df = self.df.copy()
|
88 |
+
# 移除指定列
|
89 |
+
columns_to_remove = ['group_name', 'leaderboard', 'dataset_name']
|
90 |
+
df = df.drop(columns=columns_to_remove)
|
91 |
+
# 按 NDCG@10 降序排序
|
92 |
+
return df.sort_values(by='ndcg_at_10', ascending=False)
|
93 |
+
|
94 |
+
def get_filtered_data(self, navigation=None, embd_type=None, embd_dims=None, similarity=None):
|
95 |
+
"""
|
96 |
+
Get filtered dataset based on criteria
|
97 |
+
"""
|
98 |
+
filtered_df = self.df.copy()
|
99 |
+
|
100 |
+
if navigation and navigation != "all":
|
101 |
+
filtered_df = filtered_df[filtered_df['leaderboard'] == navigation]
|
102 |
+
|
103 |
+
if embd_type and embd_type != "all":
|
104 |
+
filtered_df = filtered_df[filtered_df['embd_dtype'] == embd_type]
|
105 |
+
|
106 |
+
if similarity and similarity != "all":
|
107 |
+
filtered_df = filtered_df[filtered_df['similarity'] == similarity]
|
108 |
+
|
109 |
+
if embd_dims and isinstance(embd_dims, list) and len(embd_dims) > 0:
|
110 |
+
filtered_df = filtered_df[filtered_df['embd_dim'].isin(embd_dims)]
|
111 |
+
|
112 |
+
# 移除指定列
|
113 |
+
columns_to_remove = ['group_name', 'leaderboard', 'dataset_name']
|
114 |
+
filtered_df = filtered_df.drop(columns=columns_to_remove)
|
115 |
+
# 按 NDCG@10 降序排序
|
116 |
+
return filtered_df.sort_values(by='ndcg_at_10', ascending=False)
|
117 |
|
118 |
def _check_providers(self, organization: str, providers: List):
|
119 |
if not providers:
|
|
|
138 |
|
139 |
df_datasets_list = []
|
140 |
for item in self.datasets:
|
141 |
+
dataset_names = item["datasets"]
|
142 |
df_dataset_row = pd.DataFrame(
|
143 |
{
|
144 |
+
"group_name": [item["name"] for _ in range(len(dataset_names))],
|
145 |
"dataset_name": dataset_names,
|
146 |
"leaderboard": [item["leaderboard"] for _ in range(len(dataset_names))]
|
147 |
}
|
|
|
153 |
|
154 |
df_model = pd.DataFrame(models_list)
|
155 |
|
156 |
+
df = pd.merge(df_result, df_model, on=["model_name", "embd_dim", "embd_dtype"], how="inner")
|
157 |
df = pd.merge(df, df_dataset, on="dataset_name", how="inner")
|
158 |
|
159 |
df["model_name"] = df.apply(lambda
|
160 |
x: f"""<a target=\"_blank\" style=\"text-decoration: underline\" href=\"{x["reference"]}\">{x["model_name"]}</a>""",
|
161 |
axis=1)
|
162 |
+
if df.empty:
|
163 |
+
return pd.DataFrame(columns=COLUMNS)
|
164 |
return df[COLUMNS]
|
165 |
|
166 |
def filter_df(self, df_result: pd.DataFrame, embd_dtype: str, embd_dims: List, similarity: str, max_tokens: int):
|
app/static/css/style.css
ADDED
@@ -0,0 +1,516 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* Global styles */
|
2 |
+
body {
|
3 |
+
margin: 0;
|
4 |
+
padding: 0;
|
5 |
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
6 |
+
background-color: #ffffff;
|
7 |
+
color: #1C1F23;
|
8 |
+
}
|
9 |
+
|
10 |
+
/* App Container */
|
11 |
+
.app-container {
|
12 |
+
display: flex;
|
13 |
+
min-height: 100vh;
|
14 |
+
background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
|
15 |
+
}
|
16 |
+
|
17 |
+
/* Sidebar styles */
|
18 |
+
.sidebar {
|
19 |
+
width: 280px;
|
20 |
+
background: rgba(255, 255, 255, 0.95);
|
21 |
+
backdrop-filter: blur(10px);
|
22 |
+
border-right: 1px solid rgba(0, 0, 0, 0.1);
|
23 |
+
box-shadow: 2px 0 20px rgba(0, 0, 0, 0.05);
|
24 |
+
padding: 24px 0;
|
25 |
+
flex-shrink: 0;
|
26 |
+
}
|
27 |
+
|
28 |
+
.sidebar-header {
|
29 |
+
padding: 0 24px 20px;
|
30 |
+
border-bottom: 1px solid rgba(0, 0, 0, 0.08);
|
31 |
+
}
|
32 |
+
|
33 |
+
.sidebar-header h2 {
|
34 |
+
margin: 0;
|
35 |
+
font-size: 20px;
|
36 |
+
font-weight: 600;
|
37 |
+
background: linear-gradient(120deg, #2196F3, #00BCD4);
|
38 |
+
-webkit-background-clip: text;
|
39 |
+
-webkit-text-fill-color: transparent;
|
40 |
+
letter-spacing: 0.5px;
|
41 |
+
}
|
42 |
+
|
43 |
+
.sidebar-nav {
|
44 |
+
padding: 20px 0;
|
45 |
+
}
|
46 |
+
|
47 |
+
.nav-item {
|
48 |
+
margin: 8px 16px;
|
49 |
+
border-radius: 12px;
|
50 |
+
overflow: hidden;
|
51 |
+
transition: transform 0.2s ease;
|
52 |
+
}
|
53 |
+
|
54 |
+
.nav-item:hover {
|
55 |
+
transform: translateX(4px);
|
56 |
+
}
|
57 |
+
|
58 |
+
.nav-link {
|
59 |
+
display: flex;
|
60 |
+
align-items: center;
|
61 |
+
padding: 14px 16px;
|
62 |
+
color: #1C1F23;
|
63 |
+
text-decoration: none;
|
64 |
+
border-radius: 12px;
|
65 |
+
transition: all 0.3s ease;
|
66 |
+
font-weight: 500;
|
67 |
+
}
|
68 |
+
|
69 |
+
.nav-link:hover {
|
70 |
+
background: linear-gradient(120deg, rgba(33, 150, 243, 0.1), rgba(0, 188, 212, 0.1));
|
71 |
+
}
|
72 |
+
|
73 |
+
.nav-item.active .nav-link {
|
74 |
+
background: linear-gradient(120deg, #2196F3, #00BCD4);
|
75 |
+
color: #fff;
|
76 |
+
box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
|
77 |
+
}
|
78 |
+
|
79 |
+
.nav-icon {
|
80 |
+
margin-right: 12px;
|
81 |
+
font-size: 18px;
|
82 |
+
}
|
83 |
+
|
84 |
+
/* Main Content Wrapper */
|
85 |
+
.main-wrapper {
|
86 |
+
flex: 1;
|
87 |
+
padding: 24px;
|
88 |
+
max-width: calc(100% - 280px);
|
89 |
+
}
|
90 |
+
|
91 |
+
/* Header styles */
|
92 |
+
.header {
|
93 |
+
background: rgba(255, 255, 255, 0.95);
|
94 |
+
padding: 24px;
|
95 |
+
border-radius: 16px;
|
96 |
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
|
97 |
+
margin-bottom: 24px;
|
98 |
+
backdrop-filter: blur(10px);
|
99 |
+
border: 1px solid rgba(255, 255, 255, 0.4);
|
100 |
+
}
|
101 |
+
|
102 |
+
.header h1 {
|
103 |
+
margin: 0;
|
104 |
+
background: linear-gradient(120deg, #2196F3, #00BCD4);
|
105 |
+
-webkit-background-clip: text;
|
106 |
+
-webkit-text-fill-color: transparent;
|
107 |
+
font-size: 28px;
|
108 |
+
text-align: center;
|
109 |
+
letter-spacing: 0.5px;
|
110 |
+
}
|
111 |
+
|
112 |
+
/* Filter section styles */
|
113 |
+
.filter-section {
|
114 |
+
background-color: #fff;
|
115 |
+
padding: 20px;
|
116 |
+
border-radius: 8px;
|
117 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
118 |
+
margin-bottom: 20px;
|
119 |
+
display: grid;
|
120 |
+
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
121 |
+
gap: 20px;
|
122 |
+
}
|
123 |
+
|
124 |
+
.filter-group {
|
125 |
+
display: flex;
|
126 |
+
flex-direction: column;
|
127 |
+
gap: 8px;
|
128 |
+
}
|
129 |
+
|
130 |
+
.filter-group label {
|
131 |
+
font-weight: 600;
|
132 |
+
color: #1C1F23;
|
133 |
+
margin-bottom: 4px;
|
134 |
+
}
|
135 |
+
|
136 |
+
.semi-select {
|
137 |
+
width: 100%;
|
138 |
+
padding: 8px 12px;
|
139 |
+
border: 1px solid #e0e0e0;
|
140 |
+
border-radius: 4px;
|
141 |
+
background-color: #fff;
|
142 |
+
font-size: 14px;
|
143 |
+
transition: border-color 0.2s;
|
144 |
+
}
|
145 |
+
|
146 |
+
.semi-select:hover {
|
147 |
+
border-color: #0077FF;
|
148 |
+
}
|
149 |
+
|
150 |
+
.semi-select:focus {
|
151 |
+
border-color: #0077FF;
|
152 |
+
outline: none;
|
153 |
+
box-shadow: 0 0 0 2px rgba(0,119,255,0.2);
|
154 |
+
}
|
155 |
+
|
156 |
+
.checkbox-group {
|
157 |
+
display: flex;
|
158 |
+
flex-wrap: wrap;
|
159 |
+
gap: 10px;
|
160 |
+
}
|
161 |
+
|
162 |
+
.semi-checkbox {
|
163 |
+
display: flex;
|
164 |
+
align-items: center;
|
165 |
+
gap: 6px;
|
166 |
+
cursor: pointer;
|
167 |
+
}
|
168 |
+
|
169 |
+
.semi-checkbox input[type="checkbox"] {
|
170 |
+
width: 16px;
|
171 |
+
height: 16px;
|
172 |
+
margin: 0;
|
173 |
+
}
|
174 |
+
|
175 |
+
.semi-checkbox span {
|
176 |
+
font-size: 14px;
|
177 |
+
}
|
178 |
+
|
179 |
+
/* Table styles */
|
180 |
+
.table-container {
|
181 |
+
background: rgba(255, 255, 255, 0.95);
|
182 |
+
padding: 24px;
|
183 |
+
border-radius: 16px;
|
184 |
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
|
185 |
+
overflow-x: auto;
|
186 |
+
backdrop-filter: blur(10px);
|
187 |
+
border: 1px solid rgba(255, 255, 255, 0.4);
|
188 |
+
}
|
189 |
+
|
190 |
+
.semi-table {
|
191 |
+
width: 100%;
|
192 |
+
border-collapse: separate;
|
193 |
+
border-spacing: 0;
|
194 |
+
font-size: 14px;
|
195 |
+
}
|
196 |
+
|
197 |
+
/* Column Header Styles */
|
198 |
+
.column-header {
|
199 |
+
position: relative;
|
200 |
+
}
|
201 |
+
|
202 |
+
.header-content {
|
203 |
+
display: flex;
|
204 |
+
align-items: center;
|
205 |
+
justify-content: space-between;
|
206 |
+
padding: 16px;
|
207 |
+
background: linear-gradient(120deg, rgba(33, 150, 243, 0.05), rgba(0, 188, 212, 0.05));
|
208 |
+
font-weight: 600;
|
209 |
+
color: #1C1F23;
|
210 |
+
white-space: nowrap;
|
211 |
+
border-bottom: 2px solid transparent;
|
212 |
+
transition: all 0.3s ease;
|
213 |
+
}
|
214 |
+
|
215 |
+
.header-content:hover {
|
216 |
+
background: linear-gradient(120deg, rgba(33, 150, 243, 0.1), rgba(0, 188, 212, 0.1));
|
217 |
+
border-bottom: 2px solid #2196F3;
|
218 |
+
}
|
219 |
+
|
220 |
+
.header-actions {
|
221 |
+
display: flex;
|
222 |
+
gap: 8px;
|
223 |
+
}
|
224 |
+
|
225 |
+
.sort-btn,
|
226 |
+
.filter-btn {
|
227 |
+
background: none;
|
228 |
+
border: none;
|
229 |
+
padding: 6px;
|
230 |
+
cursor: pointer;
|
231 |
+
color: #666;
|
232 |
+
border-radius: 8px;
|
233 |
+
transition: all 0.3s ease;
|
234 |
+
display: flex;
|
235 |
+
align-items: center;
|
236 |
+
justify-content: center;
|
237 |
+
}
|
238 |
+
|
239 |
+
.sort-btn:hover,
|
240 |
+
.filter-btn:hover {
|
241 |
+
background: linear-gradient(120deg, #2196F3, #00BCD4);
|
242 |
+
color: #fff;
|
243 |
+
transform: translateY(-1px);
|
244 |
+
box-shadow: 0 4px 12px rgba(33, 150, 243, 0.2);
|
245 |
+
}
|
246 |
+
|
247 |
+
/* Filter Dropdown Styles */
|
248 |
+
.filter-dropdown {
|
249 |
+
position: absolute;
|
250 |
+
top: 100%;
|
251 |
+
left: 0;
|
252 |
+
right: 0;
|
253 |
+
background: rgba(255, 255, 255, 0.98);
|
254 |
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
255 |
+
border-radius: 12px;
|
256 |
+
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
|
257 |
+
z-index: 1000;
|
258 |
+
min-width: 240px;
|
259 |
+
backdrop-filter: blur(10px);
|
260 |
+
transform-origin: top;
|
261 |
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
262 |
+
}
|
263 |
+
|
264 |
+
.filter-content {
|
265 |
+
padding: 16px;
|
266 |
+
}
|
267 |
+
|
268 |
+
.filter-search {
|
269 |
+
width: 90%;
|
270 |
+
padding: 12px;
|
271 |
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
272 |
+
border-radius: 8px;
|
273 |
+
margin-bottom: 12px;
|
274 |
+
font-size: 14px;
|
275 |
+
background: rgba(255, 255, 255, 0.9);
|
276 |
+
transition: all 0.3s ease;
|
277 |
+
}
|
278 |
+
|
279 |
+
.filter-search:focus {
|
280 |
+
outline: none;
|
281 |
+
border-color: #2196F3;
|
282 |
+
box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
|
283 |
+
}
|
284 |
+
|
285 |
+
.filter-options {
|
286 |
+
max-height: 240px;
|
287 |
+
overflow-y: auto;
|
288 |
+
margin-bottom: 12px;
|
289 |
+
padding: 4px;
|
290 |
+
}
|
291 |
+
|
292 |
+
.filter-options::-webkit-scrollbar {
|
293 |
+
width: 8px;
|
294 |
+
}
|
295 |
+
|
296 |
+
.filter-options::-webkit-scrollbar-track {
|
297 |
+
background: rgba(0, 0, 0, 0.05);
|
298 |
+
border-radius: 4px;
|
299 |
+
}
|
300 |
+
|
301 |
+
.filter-options::-webkit-scrollbar-thumb {
|
302 |
+
background: linear-gradient(120deg, #2196F3, #00BCD4);
|
303 |
+
border-radius: 4px;
|
304 |
+
}
|
305 |
+
|
306 |
+
.filter-option {
|
307 |
+
display: flex;
|
308 |
+
align-items: center;
|
309 |
+
padding: 10px 12px;
|
310 |
+
cursor: pointer;
|
311 |
+
border-radius: 8px;
|
312 |
+
transition: all 0.3s ease;
|
313 |
+
}
|
314 |
+
|
315 |
+
.filter-option:hover {
|
316 |
+
background: linear-gradient(120deg, rgba(33, 150, 243, 0.1), rgba(0, 188, 212, 0.1));
|
317 |
+
}
|
318 |
+
|
319 |
+
.filter-option input[type="checkbox"] {
|
320 |
+
margin-right: 12px;
|
321 |
+
width: 18px;
|
322 |
+
height: 18px;
|
323 |
+
border-radius: 4px;
|
324 |
+
border: 2px solid #2196F3;
|
325 |
+
transition: all 0.3s ease;
|
326 |
+
position: relative;
|
327 |
+
cursor: pointer;
|
328 |
+
}
|
329 |
+
|
330 |
+
.filter-option input[type="checkbox"]:checked {
|
331 |
+
background: linear-gradient(120deg, #2196F3, #00BCD4);
|
332 |
+
border-color: transparent;
|
333 |
+
}
|
334 |
+
|
335 |
+
.filter-actions {
|
336 |
+
display: flex;
|
337 |
+
justify-content: flex-end;
|
338 |
+
gap: 12px;
|
339 |
+
padding-top: 12px;
|
340 |
+
border-top: 1px solid rgba(0, 0, 0, 0.08);
|
341 |
+
}
|
342 |
+
|
343 |
+
.filter-actions button {
|
344 |
+
padding: 10px 16px;
|
345 |
+
border: none;
|
346 |
+
border-radius: 8px;
|
347 |
+
cursor: pointer;
|
348 |
+
font-size: 14px;
|
349 |
+
font-weight: 500;
|
350 |
+
transition: all 0.3s ease;
|
351 |
+
}
|
352 |
+
|
353 |
+
.filter-actions button:first-child {
|
354 |
+
background: linear-gradient(120deg, #2196F3, #00BCD4);
|
355 |
+
color: #fff;
|
356 |
+
}
|
357 |
+
|
358 |
+
.filter-actions button:first-child:hover {
|
359 |
+
transform: translateY(-1px);
|
360 |
+
box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
|
361 |
+
}
|
362 |
+
|
363 |
+
.filter-actions button:last-child {
|
364 |
+
background: rgba(0, 0, 0, 0.05);
|
365 |
+
color: #1C1F23;
|
366 |
+
}
|
367 |
+
|
368 |
+
.filter-actions button:last-child:hover {
|
369 |
+
background: rgba(0, 0, 0, 0.1);
|
370 |
+
}
|
371 |
+
|
372 |
+
/* Table Body Styles */
|
373 |
+
.semi-table td {
|
374 |
+
padding: 16px;
|
375 |
+
border-bottom: 1px solid rgba(0, 0, 0, 0.08);
|
376 |
+
transition: all 0.3s ease;
|
377 |
+
}
|
378 |
+
|
379 |
+
.semi-table tbody tr {
|
380 |
+
transition: all 0.3s ease;
|
381 |
+
}
|
382 |
+
|
383 |
+
.semi-table tbody tr:hover {
|
384 |
+
background: linear-gradient(120deg, rgba(33, 150, 243, 0.05), rgba(0, 188, 212, 0.05));
|
385 |
+
transform: translateY(-1px);
|
386 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
|
387 |
+
}
|
388 |
+
|
389 |
+
/* Links in table */
|
390 |
+
.semi-table a {
|
391 |
+
color: #2196F3;
|
392 |
+
text-decoration: none;
|
393 |
+
transition: all 0.3s ease;
|
394 |
+
position: relative;
|
395 |
+
}
|
396 |
+
|
397 |
+
.semi-table a:hover {
|
398 |
+
color: #00BCD4;
|
399 |
+
}
|
400 |
+
|
401 |
+
.semi-table a::after {
|
402 |
+
content: '';
|
403 |
+
position: absolute;
|
404 |
+
width: 100%;
|
405 |
+
height: 2px;
|
406 |
+
bottom: -2px;
|
407 |
+
left: 0;
|
408 |
+
background: linear-gradient(120deg, #2196F3, #00BCD4);
|
409 |
+
transform: scaleX(0);
|
410 |
+
transition: transform 0.3s ease;
|
411 |
+
}
|
412 |
+
|
413 |
+
.semi-table a:hover::after {
|
414 |
+
transform: scaleX(1);
|
415 |
+
}
|
416 |
+
|
417 |
+
/* Responsive design */
|
418 |
+
@media (max-width: 1024px) {
|
419 |
+
.sidebar {
|
420 |
+
width: 240px;
|
421 |
+
}
|
422 |
+
|
423 |
+
.main-wrapper {
|
424 |
+
max-width: calc(100% - 240px);
|
425 |
+
padding: 16px;
|
426 |
+
}
|
427 |
+
}
|
428 |
+
|
429 |
+
@media (max-width: 768px) {
|
430 |
+
.app-container {
|
431 |
+
flex-direction: column;
|
432 |
+
}
|
433 |
+
|
434 |
+
.sidebar {
|
435 |
+
width: 100%;
|
436 |
+
border-right: none;
|
437 |
+
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
438 |
+
padding: 16px 0;
|
439 |
+
}
|
440 |
+
|
441 |
+
.main-wrapper {
|
442 |
+
max-width: 100%;
|
443 |
+
padding: 16px;
|
444 |
+
}
|
445 |
+
|
446 |
+
.header {
|
447 |
+
padding: 16px;
|
448 |
+
margin-bottom: 16px;
|
449 |
+
}
|
450 |
+
|
451 |
+
.header h1 {
|
452 |
+
font-size: 24px;
|
453 |
+
}
|
454 |
+
|
455 |
+
.table-container {
|
456 |
+
padding: 16px;
|
457 |
+
border-radius: 12px;
|
458 |
+
}
|
459 |
+
|
460 |
+
.header-content {
|
461 |
+
padding: 12px;
|
462 |
+
}
|
463 |
+
|
464 |
+
.semi-table td,
|
465 |
+
.semi-table th {
|
466 |
+
padding: 12px;
|
467 |
+
font-size: 13px;
|
468 |
+
}
|
469 |
+
|
470 |
+
.filter-dropdown {
|
471 |
+
position: fixed;
|
472 |
+
top: 50%;
|
473 |
+
left: 50%;
|
474 |
+
transform: translate(-50%, -50%);
|
475 |
+
width: 90%;
|
476 |
+
max-width: 320px;
|
477 |
+
margin: 0 auto;
|
478 |
+
}
|
479 |
+
}
|
480 |
+
|
481 |
+
/* Dark mode support */
|
482 |
+
@media (prefers-color-scheme: dark) {
|
483 |
+
body {
|
484 |
+
background-color: #121212;
|
485 |
+
color: #ffffff;
|
486 |
+
}
|
487 |
+
|
488 |
+
.app-container {
|
489 |
+
background: linear-gradient(135deg, #121212 0%, #1a1a1a 100%);
|
490 |
+
}
|
491 |
+
|
492 |
+
.sidebar,
|
493 |
+
.header,
|
494 |
+
.table-container {
|
495 |
+
background: rgba(255, 255, 255, 0.05);
|
496 |
+
border-color: rgba(255, 255, 255, 0.1);
|
497 |
+
}
|
498 |
+
|
499 |
+
.semi-table td {
|
500 |
+
border-color: rgba(255, 255, 255, 0.1);
|
501 |
+
}
|
502 |
+
|
503 |
+
.filter-dropdown {
|
504 |
+
background: rgba(18, 18, 18, 0.98);
|
505 |
+
}
|
506 |
+
|
507 |
+
.filter-search {
|
508 |
+
background: rgba(255, 255, 255, 0.05);
|
509 |
+
border-color: rgba(255, 255, 255, 0.1);
|
510 |
+
color: #ffffff;
|
511 |
+
}
|
512 |
+
|
513 |
+
.filter-option:hover {
|
514 |
+
background: rgba(255, 255, 255, 0.05);
|
515 |
+
}
|
516 |
+
}
|
app/static/js/main.js
ADDED
@@ -0,0 +1,258 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Global variables for sorting and filtering
|
2 |
+
let currentSortColumn = -1;
|
3 |
+
let isAscending = true;
|
4 |
+
let columnFilters = {};
|
5 |
+
let columnValues = {};
|
6 |
+
|
7 |
+
// Function to update the table based on filters
|
8 |
+
async function updateTable() {
|
9 |
+
const navigation = document.getElementById('navigation').value;
|
10 |
+
const embdType = document.getElementById('embdType').value;
|
11 |
+
const similarity = document.getElementById('similarity').value;
|
12 |
+
|
13 |
+
// Get all checked embedding dimensions
|
14 |
+
const embdDims = Array.from(document.querySelectorAll('input[name="embdDim"]:checked'))
|
15 |
+
.map(checkbox => checkbox.value);
|
16 |
+
|
17 |
+
// Prepare filter data
|
18 |
+
const filters = {
|
19 |
+
navigation: navigation,
|
20 |
+
embd_type: embdType,
|
21 |
+
embd_dims: embdDims,
|
22 |
+
similarity: similarity
|
23 |
+
};
|
24 |
+
|
25 |
+
try {
|
26 |
+
const response = await fetch('/api/filter', {
|
27 |
+
method: 'POST',
|
28 |
+
headers: {
|
29 |
+
'Content-Type': 'application/json'
|
30 |
+
},
|
31 |
+
body: JSON.stringify(filters)
|
32 |
+
});
|
33 |
+
|
34 |
+
if (!response.ok) {
|
35 |
+
throw new Error(`HTTP error! status: ${response.status}`);
|
36 |
+
}
|
37 |
+
|
38 |
+
const data = await response.json();
|
39 |
+
updateTableContent(data);
|
40 |
+
} catch (error) {
|
41 |
+
console.error('Error updating table:', error);
|
42 |
+
alert('Failed to update table. Please try again.');
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
// Function to update table content
|
47 |
+
function updateTableContent(data) {
|
48 |
+
const tbody = document.querySelector('#leaderboardTable tbody');
|
49 |
+
tbody.innerHTML = '';
|
50 |
+
|
51 |
+
data.forEach(row => {
|
52 |
+
const tr = document.createElement('tr');
|
53 |
+
row.forEach(cell => {
|
54 |
+
const td = document.createElement('td');
|
55 |
+
td.innerHTML = cell; // Use innerHTML instead of textContent to handle HTML content
|
56 |
+
tr.appendChild(td);
|
57 |
+
});
|
58 |
+
tbody.appendChild(tr);
|
59 |
+
});
|
60 |
+
}
|
61 |
+
|
62 |
+
// Initialize when document is ready
|
63 |
+
document.addEventListener('DOMContentLoaded', () => {
|
64 |
+
initializeColumnValues();
|
65 |
+
document.addEventListener('click', handleClickOutside);
|
66 |
+
});
|
67 |
+
|
68 |
+
// Initialize unique values for each column
|
69 |
+
function initializeColumnValues() {
|
70 |
+
const table = document.getElementById('leaderboardTable');
|
71 |
+
const headers = Array.from(table.querySelectorAll('th'));
|
72 |
+
const rows = Array.from(table.querySelectorAll('tbody tr'));
|
73 |
+
|
74 |
+
headers.forEach((header, columnIndex) => {
|
75 |
+
const columnName = header.querySelector('span').textContent;
|
76 |
+
const values = new Set();
|
77 |
+
|
78 |
+
rows.forEach(row => {
|
79 |
+
const cell = row.cells[columnIndex];
|
80 |
+
const value = cell.textContent.trim();
|
81 |
+
if (value) values.add(value);
|
82 |
+
});
|
83 |
+
|
84 |
+
columnValues[columnName] = Array.from(values).sort();
|
85 |
+
});
|
86 |
+
}
|
87 |
+
|
88 |
+
// Handle clicking outside filter dropdowns
|
89 |
+
function handleClickOutside(event) {
|
90 |
+
const dropdowns = document.querySelectorAll('.filter-dropdown');
|
91 |
+
dropdowns.forEach(dropdown => {
|
92 |
+
const filterBtn = dropdown.parentElement.querySelector('.filter-btn');
|
93 |
+
if (!dropdown.contains(event.target) && !filterBtn.contains(event.target)) {
|
94 |
+
dropdown.style.display = 'none';
|
95 |
+
}
|
96 |
+
});
|
97 |
+
}
|
98 |
+
|
99 |
+
// Toggle filter dropdown
|
100 |
+
function toggleFilter(event, columnName) {
|
101 |
+
event.stopPropagation();
|
102 |
+
const dropdown = document.getElementById(`filter-${columnName}`);
|
103 |
+
const options = document.getElementById(`options-${columnName}`);
|
104 |
+
|
105 |
+
// Close other dropdowns
|
106 |
+
document.querySelectorAll('.filter-dropdown').forEach(d => {
|
107 |
+
if (d !== dropdown) d.style.display = 'none';
|
108 |
+
});
|
109 |
+
|
110 |
+
if (dropdown.style.display === 'none') {
|
111 |
+
dropdown.style.display = 'block';
|
112 |
+
if (!options.children.length) {
|
113 |
+
populateFilterOptions(columnName);
|
114 |
+
}
|
115 |
+
} else {
|
116 |
+
dropdown.style.display = 'none';
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
// Populate filter options
|
121 |
+
function populateFilterOptions(columnName) {
|
122 |
+
const options = document.getElementById(`options-${columnName}`);
|
123 |
+
options.innerHTML = '';
|
124 |
+
|
125 |
+
columnValues[columnName].forEach(value => {
|
126 |
+
const option = document.createElement('div');
|
127 |
+
option.className = 'filter-option';
|
128 |
+
|
129 |
+
const checkbox = document.createElement('input');
|
130 |
+
checkbox.type = 'checkbox';
|
131 |
+
checkbox.value = value;
|
132 |
+
checkbox.checked = columnFilters[columnName]?.includes(value) || false;
|
133 |
+
|
134 |
+
const label = document.createElement('span');
|
135 |
+
label.textContent = value;
|
136 |
+
|
137 |
+
option.appendChild(checkbox);
|
138 |
+
option.appendChild(label);
|
139 |
+
options.appendChild(option);
|
140 |
+
});
|
141 |
+
}
|
142 |
+
|
143 |
+
// Filter options based on search input
|
144 |
+
function filterOptions(columnName) {
|
145 |
+
const searchInput = document.querySelector(`#filter-${columnName} .filter-search`);
|
146 |
+
const searchTerm = searchInput.value.toLowerCase();
|
147 |
+
const options = document.getElementById(`options-${columnName}`);
|
148 |
+
|
149 |
+
Array.from(options.children).forEach(option => {
|
150 |
+
const text = option.textContent.toLowerCase();
|
151 |
+
option.style.display = text.includes(searchTerm) ? '' : 'none';
|
152 |
+
});
|
153 |
+
}
|
154 |
+
|
155 |
+
// Apply filter
|
156 |
+
function applyFilter(columnName) {
|
157 |
+
const options = document.getElementById(`options-${columnName}`);
|
158 |
+
const checkedValues = Array.from(options.querySelectorAll('input[type="checkbox"]:checked'))
|
159 |
+
.map(cb => cb.value);
|
160 |
+
|
161 |
+
columnFilters[columnName] = checkedValues;
|
162 |
+
updateTableVisibility();
|
163 |
+
document.getElementById(`filter-${columnName}`).style.display = 'none';
|
164 |
+
}
|
165 |
+
|
166 |
+
// Clear filter
|
167 |
+
function clearFilter(columnName) {
|
168 |
+
const options = document.getElementById(`options-${columnName}`);
|
169 |
+
options.querySelectorAll('input[type="checkbox"]').forEach(cb => cb.checked = false);
|
170 |
+
delete columnFilters[columnName];
|
171 |
+
updateTableVisibility();
|
172 |
+
document.getElementById(`filter-${columnName}`).style.display = 'none';
|
173 |
+
}
|
174 |
+
|
175 |
+
// Update table visibility based on filters
|
176 |
+
function updateTableVisibility() {
|
177 |
+
const table = document.getElementById('leaderboardTable');
|
178 |
+
const rows = Array.from(table.querySelectorAll('tbody tr'));
|
179 |
+
const headers = Array.from(table.querySelectorAll('th'));
|
180 |
+
|
181 |
+
rows.forEach(row => {
|
182 |
+
let visible = true;
|
183 |
+
|
184 |
+
Object.entries(columnFilters).forEach(([columnName, selectedValues]) => {
|
185 |
+
if (!selectedValues.length) return;
|
186 |
+
|
187 |
+
const columnIndex = headers.findIndex(header =>
|
188 |
+
header.querySelector('span').textContent === columnName
|
189 |
+
);
|
190 |
+
|
191 |
+
const cellValue = row.cells[columnIndex].textContent.trim();
|
192 |
+
if (!selectedValues.includes(cellValue)) {
|
193 |
+
visible = false;
|
194 |
+
}
|
195 |
+
});
|
196 |
+
|
197 |
+
row.style.display = visible ? '' : 'none';
|
198 |
+
});
|
199 |
+
}
|
200 |
+
|
201 |
+
// Sort table
|
202 |
+
function sortTable(columnIndex) {
|
203 |
+
const table = document.getElementById('leaderboardTable');
|
204 |
+
const tbody = table.querySelector('tbody');
|
205 |
+
const rows = Array.from(tbody.querySelectorAll('tr'));
|
206 |
+
|
207 |
+
// Update sort direction
|
208 |
+
if (currentSortColumn === columnIndex) {
|
209 |
+
isAscending = !isAscending;
|
210 |
+
} else {
|
211 |
+
currentSortColumn = columnIndex;
|
212 |
+
isAscending = true;
|
213 |
+
}
|
214 |
+
|
215 |
+
// Sort rows
|
216 |
+
rows.sort((a, b) => {
|
217 |
+
let aValue = a.cells[columnIndex].textContent;
|
218 |
+
let bValue = b.cells[columnIndex].textContent;
|
219 |
+
|
220 |
+
// Remove HTML tags for comparison
|
221 |
+
aValue = aValue.replace(/<[^>]*>/g, '').trim();
|
222 |
+
bValue = bValue.replace(/<[^>]*>/g, '').trim();
|
223 |
+
|
224 |
+
// Check if the values are numbers
|
225 |
+
const aNum = parseFloat(aValue);
|
226 |
+
const bNum = parseFloat(bValue);
|
227 |
+
|
228 |
+
if (!isNaN(aNum) && !isNaN(bNum)) {
|
229 |
+
return isAscending ? aNum - bNum : bNum - aNum;
|
230 |
+
}
|
231 |
+
|
232 |
+
// Sort as strings
|
233 |
+
return isAscending
|
234 |
+
? aValue.localeCompare(bValue)
|
235 |
+
: bValue.localeCompare(aValue);
|
236 |
+
});
|
237 |
+
|
238 |
+
// Update table
|
239 |
+
tbody.innerHTML = '';
|
240 |
+
rows.forEach(row => tbody.appendChild(row));
|
241 |
+
|
242 |
+
// Update sort indicators
|
243 |
+
const headers = table.querySelectorAll('.sort-icon');
|
244 |
+
headers.forEach((icon, index) => {
|
245 |
+
icon.textContent = index === columnIndex
|
246 |
+
? (isAscending ? '↑' : '↓')
|
247 |
+
: '↕';
|
248 |
+
});
|
249 |
+
}
|
250 |
+
|
251 |
+
// Initialize table sorting and filtering
|
252 |
+
document.addEventListener('DOMContentLoaded', () => {
|
253 |
+
// Add event listener for checkboxes
|
254 |
+
const checkboxes = document.querySelectorAll('input[name="embdDim"]');
|
255 |
+
checkboxes.forEach(checkbox => {
|
256 |
+
checkbox.addEventListener('change', updateTable);
|
257 |
+
});
|
258 |
+
});
|
app/templates/index.html
ADDED
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>MTEB Leaderboard</title>
|
7 |
+
<!-- Semi Design CSS -->
|
8 |
+
<link rel="stylesheet" href="https://unpkg.com/@douyinfe/semi-ui/dist/css/semi.min.css">
|
9 |
+
<!-- Custom CSS -->
|
10 |
+
<link rel="stylesheet" href="{{ url_for('static', path='css/style.css') }}">
|
11 |
+
<style>
|
12 |
+
.sidebar-nav {
|
13 |
+
padding: 1rem;
|
14 |
+
}
|
15 |
+
|
16 |
+
.nav-item {
|
17 |
+
margin-bottom: 1rem;
|
18 |
+
border-radius: 8px;
|
19 |
+
overflow: hidden;
|
20 |
+
}
|
21 |
+
|
22 |
+
.nav-link {
|
23 |
+
display: flex;
|
24 |
+
align-items: center;
|
25 |
+
padding: 0.8rem 1rem;
|
26 |
+
color: #333;
|
27 |
+
text-decoration: none;
|
28 |
+
font-weight: 500;
|
29 |
+
transition: all 0.3s ease;
|
30 |
+
}
|
31 |
+
|
32 |
+
.nav-icon {
|
33 |
+
margin-right: 0.8rem;
|
34 |
+
font-size: 1.2rem;
|
35 |
+
}
|
36 |
+
|
37 |
+
.subnav {
|
38 |
+
display: none;
|
39 |
+
background: #f5f5f5;
|
40 |
+
padding: 0.5rem 0;
|
41 |
+
}
|
42 |
+
|
43 |
+
.nav-item.active .subnav {
|
44 |
+
display: block;
|
45 |
+
}
|
46 |
+
|
47 |
+
.subnav-link {
|
48 |
+
display: block;
|
49 |
+
padding: 0.5rem 1rem 0.5rem 2.8rem;
|
50 |
+
color: #666;
|
51 |
+
text-decoration: none;
|
52 |
+
font-size: 0.9rem;
|
53 |
+
transition: all 0.2s ease;
|
54 |
+
}
|
55 |
+
|
56 |
+
.subnav-link:hover {
|
57 |
+
background: #e0e0e0;
|
58 |
+
color: #333;
|
59 |
+
}
|
60 |
+
|
61 |
+
.subnav-link.active {
|
62 |
+
background: #e0e0e0;
|
63 |
+
color: #1890ff;
|
64 |
+
font-weight: 500;
|
65 |
+
}
|
66 |
+
|
67 |
+
.nav-item.active .nav-link {
|
68 |
+
background: #1890ff;
|
69 |
+
color: white;
|
70 |
+
}
|
71 |
+
</style>
|
72 |
+
</head>
|
73 |
+
<body>
|
74 |
+
<div class="app-container">
|
75 |
+
<!-- Sidebar -->
|
76 |
+
<aside class="sidebar">
|
77 |
+
<div class="sidebar-header">
|
78 |
+
<h2>Navigation</h2>
|
79 |
+
</div>
|
80 |
+
<nav class="sidebar-nav">
|
81 |
+
<div class="nav-item {% if active_tab == 'text' %}active{% endif %}">
|
82 |
+
<a href="/?tab=text" class="nav-link">
|
83 |
+
<span class="nav-icon">📝</span>
|
84 |
+
Text Leaderboard
|
85 |
+
</a>
|
86 |
+
<div class="subnav">
|
87 |
+
{% for subtype in ["text", "law", "long-context", "finance", "conversational", "tech", "multilingual", "code", "healthcare"] %}
|
88 |
+
<a href="/?tab=text&subtype={{ subtype }}" class="subnav-link {% if active_subtype == subtype %}active{% endif %}">
|
89 |
+
{{ subtype | title }}
|
90 |
+
</a>
|
91 |
+
{% endfor %}
|
92 |
+
</div>
|
93 |
+
</div>
|
94 |
+
<div class="nav-item {% if active_tab == 'multimodal' %}active{% endif %}">
|
95 |
+
<a href="/?tab=multimodal" class="nav-link">
|
96 |
+
<span class="nav-icon">🖼️</span>
|
97 |
+
Multimodal Leaderboard
|
98 |
+
</a>
|
99 |
+
<div class="subnav">
|
100 |
+
{% for subtype in ["text-to-photo", "document-screenshot", "figures-and-tables", "text-to-text"] %}
|
101 |
+
<a href="/?tab=multimodal&subtype={{ subtype }}" class="subnav-link {% if active_subtype == subtype %}active{% endif %}">
|
102 |
+
{{ subtype | title }}
|
103 |
+
</a>
|
104 |
+
{% endfor %}
|
105 |
+
</div>
|
106 |
+
</div>
|
107 |
+
</nav>
|
108 |
+
</aside>
|
109 |
+
|
110 |
+
<!-- Main Content -->
|
111 |
+
<div class="main-wrapper">
|
112 |
+
<header class="header">
|
113 |
+
<h1>Massive Text Embedding Benchmark (MTEB) Leaderboard</h1>
|
114 |
+
</header>
|
115 |
+
|
116 |
+
<main class="main-content">
|
117 |
+
<div class="table-container">
|
118 |
+
<table id="leaderboardTable" class="semi-table">
|
119 |
+
<thead>
|
120 |
+
<tr>
|
121 |
+
{% for col in columns %}
|
122 |
+
<th>
|
123 |
+
<div class="column-header">
|
124 |
+
<div class="header-content">
|
125 |
+
<span>{{ col }}</span>
|
126 |
+
<div class="header-actions">
|
127 |
+
<button class="sort-btn" onclick="sortTable({{ loop.index0 }})">
|
128 |
+
<span class="sort-icon">↕</span>
|
129 |
+
</button>
|
130 |
+
<button class="filter-btn" onclick="toggleFilter(event, '{{ col }}')">
|
131 |
+
<span class="filter-icon">⚡</span>
|
132 |
+
</button>
|
133 |
+
</div>
|
134 |
+
</div>
|
135 |
+
<div class="filter-dropdown" id="filter-{{ col }}" style="display: none;">
|
136 |
+
<div class="filter-content">
|
137 |
+
<input type="text"
|
138 |
+
class="filter-search"
|
139 |
+
placeholder="Search..."
|
140 |
+
oninput="filterOptions('{{ col }}')">
|
141 |
+
<div class="filter-options" id="options-{{ col }}">
|
142 |
+
<!-- Options will be populated by JavaScript -->
|
143 |
+
</div>
|
144 |
+
<div class="filter-actions">
|
145 |
+
<button onclick="applyFilter('{{ col }}')">Apply</button>
|
146 |
+
<button onclick="clearFilter('{{ col }}')">Clear</button>
|
147 |
+
</div>
|
148 |
+
</div>
|
149 |
+
</div>
|
150 |
+
</div>
|
151 |
+
</th>
|
152 |
+
{% endfor %}
|
153 |
+
</tr>
|
154 |
+
</thead>
|
155 |
+
<tbody>
|
156 |
+
{% for row in data %}
|
157 |
+
<tr>
|
158 |
+
{% for cell in row %}
|
159 |
+
<td>{{ cell | safe }}</td>
|
160 |
+
{% endfor %}
|
161 |
+
</tr>
|
162 |
+
{% endfor %}
|
163 |
+
</tbody>
|
164 |
+
</table>
|
165 |
+
</div>
|
166 |
+
</main>
|
167 |
+
</div>
|
168 |
+
</div>
|
169 |
+
|
170 |
+
<!-- Semi Design JS -->
|
171 |
+
<script src="https://unpkg.com/@douyinfe/semi-ui/dist/js/semi.min.js"></script>
|
172 |
+
<!-- Custom JS -->
|
173 |
+
<script src="{{ url_for('static', path='js/main.js') }}"></script>
|
174 |
+
</body>
|
175 |
+
</html>
|
app/ui/component/subtabs_component.py
CHANGED
@@ -31,11 +31,11 @@ class SubtabsComponent:
|
|
31 |
df_result = df_result.sort_values(by=sort_col, ascending=False)
|
32 |
|
33 |
items = []
|
34 |
-
for
|
35 |
-
with gr.Column(visible=
|
36 |
with gr.Tabs():
|
37 |
with gr.TabItem("overall"):
|
38 |
-
df_leaderboard = df_result[df_result["
|
39 |
gr_df = gr.Dataframe(
|
40 |
df_leaderboard,
|
41 |
datatype=COLUMNS_TYPES,
|
@@ -46,9 +46,9 @@ class SubtabsComponent:
|
|
46 |
|
47 |
items.append(gr_df)
|
48 |
|
49 |
-
for
|
50 |
-
with gr.TabItem(
|
51 |
-
df = df_leaderboard[df_leaderboard["
|
52 |
gr_df = gr.Dataframe(
|
53 |
df,
|
54 |
datatype=COLUMNS_TYPES,
|
|
|
31 |
df_result = df_result.sort_values(by=sort_col, ascending=False)
|
32 |
|
33 |
items = []
|
34 |
+
for group_name,leaderboards in LEADERBOARD_MAP.items():
|
35 |
+
with gr.Column(visible=group_name.upper() == navigations.upper()) as column:
|
36 |
with gr.Tabs():
|
37 |
with gr.TabItem("overall"):
|
38 |
+
df_leaderboard = df_result[df_result["group_name"] == group_name]
|
39 |
gr_df = gr.Dataframe(
|
40 |
df_leaderboard,
|
41 |
datatype=COLUMNS_TYPES,
|
|
|
46 |
|
47 |
items.append(gr_df)
|
48 |
|
49 |
+
for leaderboard in leaderboards:
|
50 |
+
with gr.TabItem(leaderboard):
|
51 |
+
df = df_leaderboard[df_leaderboard["leaderboard"] == leaderboard]
|
52 |
gr_df = gr.Dataframe(
|
53 |
df,
|
54 |
datatype=COLUMNS_TYPES,
|
mock_data/datasets.json
DELETED
@@ -1,17 +0,0 @@
|
|
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/models.json
DELETED
@@ -1,113 +0,0 @@
|
|
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
DELETED
The diff for this file is too large to render.
See raw diff
|
|
requirements.txt
CHANGED
@@ -1,3 +1,7 @@
|
|
1 |
gradio==4.20.0
|
2 |
uvicorn>=0.14.0
|
3 |
fastapi<0.113.0
|
|
|
|
|
|
|
|
|
|
1 |
gradio==4.20.0
|
2 |
uvicorn>=0.14.0
|
3 |
fastapi<0.113.0
|
4 |
+
jinja2>=3.0.0
|
5 |
+
python-multipart>=0.0.5
|
6 |
+
aiofiles>=0.8.0
|
7 |
+
pandas>=1.3.0
|
utils/cache_decorator.py
CHANGED
@@ -32,6 +32,27 @@ def cache_df_with_custom_key(cache_key: str):
|
|
32 |
return decorator
|
33 |
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
if __name__ == '__main__':
|
36 |
a = time.time()
|
37 |
time.sleep(5)
|
|
|
32 |
return decorator
|
33 |
|
34 |
|
35 |
+
def cache_dict_with_custom_key(cache_key: str):
|
36 |
+
def decorator(func):
|
37 |
+
@wraps(func)
|
38 |
+
def wrapper(*args, **kwargs):
|
39 |
+
if cache_key in CACHE and CACHE[cache_key].get("expiry") - time.time() < TTL:
|
40 |
+
return CACHE[cache_key]["data"]
|
41 |
+
|
42 |
+
result: dict = func(*args, **kwargs)
|
43 |
+
if result:
|
44 |
+
d = {"expiry": time.time(), "data": result}
|
45 |
+
CACHE[cache_key] = d
|
46 |
+
return result
|
47 |
+
|
48 |
+
CACHE[cache_key]["expiry"] += TTL
|
49 |
+
return CACHE[cache_key]["data"]
|
50 |
+
|
51 |
+
return wrapper
|
52 |
+
|
53 |
+
return decorator
|
54 |
+
|
55 |
+
|
56 |
if __name__ == '__main__':
|
57 |
a = time.time()
|
58 |
time.sleep(5)
|
utils/http_utils.py
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
|
3 |
+
|
4 |
+
def get(url: str, params: str = None, verify: bool = False):
|
5 |
+
return requests.get(url, params, verify=verify)
|
6 |
+
|
7 |
+
|