Spaces:
Running
Running
File size: 1,995 Bytes
fcfc2f6 |
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 |
import os
import streamlit as st
from huggingface_hub import Repository
from pandas import read_csv
from st_aggrid import AgGrid, GridOptionsBuilder, JsCode
st.set_page_config(layout="wide")
st.markdown("# 🤗 Whisper Event: Final Leaderboard")
RESULTS_REPO = "results"
RESULTS_URL = os.path.join(
"https://huggingface.co/datasets/whisper-event", RESULTS_REPO
)
HF_TOKEN = os.environ.get("HF_TOKEN")
results_repo = Repository(
local_dir="results", clone_from=RESULTS_URL, use_auth_token=HF_TOKEN
)
results_repo.git_pull()
query_params = st.experimental_get_query_params()
if "first_query_params" not in st.session_state:
st.session_state.first_query_params = query_params
first_query_params = st.session_state.first_query_params
selectable_datasets = ["mozilla-foundation/common_voice_11_0", "google/fleurs"]
selectable_metrics = ["wer", "cer"]
sorting_metric = selectable_metrics[0]
split = "test"
dataset = st.selectbox(
"Dataset",
selectable_datasets,
help="Select a dataset to see the leaderboard!"
)
dataset_df = read_csv(f"results/{dataset.split('/')[-1]}/results.csv")
current_query_params = {"dataset": [dataset]}
st.experimental_set_query_params(**current_query_params)
# Make the leaderboard
gb = GridOptionsBuilder.from_dataframe(dataset_df)
gb.configure_default_column(sortable=False)
gb.configure_column(
"model_id",
cellRenderer=JsCode('''function(params) {return '<a target="_blank" href="https://huggingface.co/'+params.value+'">'+params.value+'</a>'}'''),
)
for name in selectable_metrics:
gb.configure_column(name, type=["numericColumn", "numberColumnFilter", "customNumericFormat"], precision=2, aggFunc='sum')
gb.configure_column(
sorting_metric,
sortable=True,
)
go = gb.build()
fit_columns = len(dataset_df.columns) < 10
AgGrid(dataset_df, gridOptions=go, height=28 * len(dataset_df) + (35 if fit_columns else 41), allow_unsafe_jscode=True, fit_columns_on_grid_load=fit_columns, enable_enterprise_modules=False)
|