Spaces:
No application file
No application file
File size: 3,712 Bytes
e7d518b 8772b50 f646fc1 8772b50 e7d518b 8772b50 f646fc1 8772b50 f646fc1 8772b50 f646fc1 8772b50 e7d518b 8772b50 e7d518b 8772b50 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
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
|