smile
Update dependeies and filter logic.
e7d518b
import time
import pandas as pd
from app.backend.constant import Navigation, ModelProvider, EvaluationMetric, EmbdDtype, EmbdDim, Similarity
from app.backend.data_engine import DataEngine
from app.ui.component.filter_component import FilterComponent
from app.ui.component.subtabs_component import SubtabsComponent
from app.ui.static import HOME_CSS
import gradio as gr
NUM_DATASETS = 1
NUM_SCORES = 2
NUM_MODELS = 3
HANDLING = False
def init_home():
"""
Initialize the home page
"""
data_engine = DataEngine()
with gr.Blocks(css=HOME_CSS) as block:
gr.Markdown(f"""
[Voyageai] Massive Text Embedding Benchmark (MTEB) Leaderboard.
""")
filter_area = FilterComponent(
data_engine,
[element.value for element in Navigation],
[element.value for element in ModelProvider],
[element.value for element in EvaluationMetric],
[element.value for element in EmbdDtype],
[element.value for element in EmbdDim],
[element.value for element in Similarity],
)
navigations, model_provides, evaluation_metrics, embd_dtypes, embd_dims, similarities, max_tokens = filter_area.show()
sub_tabs = SubtabsComponent(data_engine)
columns = sub_tabs.show()
# df_area = DataFrameComponent(data_engine)
# df_display = df_area.show(pd.DataFrame(columns=[element.value for element in Navigation]))
block.load(sub_tabs.show,
inputs=[navigations, model_provides, evaluation_metrics, embd_dtypes, embd_dims, similarities,
max_tokens], outputs=columns)
navigations.change(trigger_mode="once", fn=sub_tabs.show,
inputs=[navigations, model_provides, evaluation_metrics, embd_dtypes, embd_dims,
similarities,
max_tokens], outputs=columns)
model_provides.change(trigger_mode="once", fn=sub_tabs.show,
inputs=[navigations, model_provides, evaluation_metrics, embd_dtypes, embd_dims,
similarities,
max_tokens], outputs=columns)
evaluation_metrics.change(trigger_mode="once", fn=sub_tabs.show,
inputs=[navigations, model_provides, evaluation_metrics, embd_dtypes, embd_dims,
similarities,
max_tokens], outputs=columns)
embd_dtypes.change(trigger_mode="once", fn=sub_tabs.show,
inputs=[navigations, model_provides, evaluation_metrics, embd_dtypes, embd_dims,
similarities,
max_tokens], outputs=columns)
embd_dims.change(trigger_mode="once", fn=sub_tabs.show,
inputs=[navigations, model_provides, evaluation_metrics, embd_dtypes, embd_dims, similarities,
max_tokens], outputs=columns)
similarities.change(trigger_mode="once", fn=sub_tabs.show,
inputs=[navigations, model_provides, evaluation_metrics, embd_dtypes, embd_dims,
similarities,
max_tokens], outputs=columns)
max_tokens.change(trigger_mode="always_last", fn=sub_tabs.show,
inputs=[navigations, model_provides, evaluation_metrics, embd_dtypes, embd_dims, similarities,
max_tokens], outputs=columns)
block.queue(max_size=1)
return block