|
import streamlit as st |
|
import pandas as pd |
|
import numpy as np |
|
from streamlit_echarts import st_echarts |
|
from streamlit.components.v1 import html |
|
|
|
from app.show_examples import * |
|
import pandas as pd |
|
|
|
|
|
|
|
|
|
|
|
path = "./additional_info/Leaderboard-Rename.xlsx" |
|
info_df = pd.read_excel(path) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def draw(folder_name, category_name, dataset_name, metrics, cus_sort=True): |
|
|
|
folder = f"./results/{metrics}/" |
|
|
|
display_names = { |
|
'SU': 'Speech Understanding', |
|
'ASU': 'Audio Scene Understanding', |
|
'VU': 'Voice Understanding' |
|
} |
|
|
|
data_path = f'{folder}/{category_name.lower()}.csv' |
|
chart_data = pd.read_csv(data_path).round(3) |
|
new_dataset_name = dataset_name.replace('-', '_').lower() |
|
chart_data = chart_data[['Model', new_dataset_name]] |
|
|
|
st.markdown(""" |
|
<style> |
|
.stMultiSelect [data-baseweb=select] span { |
|
max-width: 800px; |
|
font-size: 0.9rem; |
|
background-color: #3C6478 !important; /* Background color for selected items */ |
|
color: white; /* Change text color */ |
|
back |
|
} |
|
</style> |
|
""", unsafe_allow_html=True) |
|
|
|
|
|
display_model_names = {key.strip() :val.strip() for key, val in zip(info_df['AudioBench'], info_df['Proper Display Name'])} |
|
chart_data['model_show'] = chart_data['Model'].map(display_model_names) |
|
|
|
models = st.multiselect("Please choose the model", |
|
sorted(chart_data['model_show'].tolist()), |
|
default = sorted(chart_data['model_show'].tolist())) |
|
|
|
chart_data = chart_data[chart_data['model_show'].isin(models)] |
|
|
|
chart_data = chart_data.sort_values(by=[new_dataset_name], ascending=cus_sort).dropna(axis=0) |
|
|
|
|
|
|
|
|
|
if len(chart_data) == 0: |
|
return |
|
|
|
min_value = round(min(chart_data.iloc[:, 1]) - 0.1*min(chart_data.iloc[:, 1]), 1) |
|
max_value = round(max(chart_data.iloc[:, 1]) + 0.1*max(chart_data.iloc[:, 1]), 1) |
|
|
|
options = { |
|
"title": {"text": f"{display_names[folder_name.upper()]}"}, |
|
"tooltip": { |
|
"trigger": "axis", |
|
"axisPointer": {"type": "cross", "label": {"backgroundColor": "#6a7985"}}, |
|
"triggerOn": 'mousemove', |
|
}, |
|
"legend": {"data": ['Overall Accuracy']}, |
|
"toolbox": {"feature": {"saveAsImage": {}}}, |
|
"grid": {"left": "3%", "right": "4%", "bottom": "3%", "containLabel": True}, |
|
"xAxis": [ |
|
{ |
|
"type": "category", |
|
"boundaryGap": True, |
|
"triggerEvent": True, |
|
"data": chart_data['model_show'].tolist(), |
|
} |
|
], |
|
"yAxis": [{"type": "value", |
|
"min": min_value, |
|
"max": max_value, |
|
"boundaryGap": True |
|
|
|
}], |
|
"series": [{ |
|
"name": f"{dataset_name}", |
|
"type": "bar", |
|
"data": chart_data[f'{new_dataset_name}'].tolist(), |
|
}], |
|
} |
|
|
|
events = { |
|
"click": "function(params) { return params.value }" |
|
} |
|
|
|
value = st_echarts(options=options, events=events, height="500px") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
''' |
|
Show table |
|
''' |
|
|
|
with st.container(): |
|
|
|
st.markdown('##### TABLE') |
|
|
|
|
|
|
|
|
|
|
|
model_link = {key.strip(): val for key, val in zip(info_df['Proper Display Name'], info_df['Link'])} |
|
|
|
chart_data['model_link'] = chart_data['model_show'].map(model_link) |
|
|
|
|
|
|
|
|
|
chart_data_table = chart_data[['model_show', chart_data.columns[1], chart_data.columns[3]]] |
|
|
|
st.dataframe( |
|
chart_data_table, |
|
column_config={ |
|
'model_show': 'Model', |
|
chart_data_table.columns[1]: {'alignment': 'center'}, |
|
"model_link": st.column_config.LinkColumn( |
|
"Model Link", |
|
|
|
|
|
|
|
|
|
), |
|
}, |
|
hide_index=True, |
|
use_container_width=True |
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
''' |
|
show samples |
|
''' |
|
if dataset_name in ['Earnings21-Test', 'Earnings22-Test', 'Tedlium3-Long-form-Test']: |
|
pass |
|
else: |
|
show_examples(category_name, dataset_name, chart_data['Model'].tolist()) |
|
|
|
|