Spaces:
Sleeping
Sleeping
import pandas as pd | |
import streamlit as st | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
import os | |
import json | |
from utils import read_reports, dict_to_multindex_df | |
#add_test_split_stats_from_secret_dataset, dict_to_multindex_df_all_splits | |
from utils import extract_stats_to_agg, extract_stats_all_splits, extract_stats_for_dataset_card | |
from constants import BIGOS_INFO, PELCRA_INFO, ABOUT_INFO | |
from datasets import get_dataset_config_names | |
# PL ASR BIGOS analysis | |
# PL ASR Diagnostic analysis | |
# PELCRA analysis | |
# TODO - compare the datasets | |
st.set_page_config(layout="wide") | |
about, analysis_bigos, analysis_bigos_pelcra = st.tabs(["About BIGOS datasets", "BIGOS V2 analysis", "PELCRA for BIGOS analysis"]) | |
#analysis_bigos_diagnostic | |
#########################################BIGOS################################################ | |
with about: | |
st.title("About BIGOS project") | |
st.markdown(ABOUT_INFO, unsafe_allow_html=True) | |
# TODO - load and display about BIGOS benchmark | |
with analysis_bigos: | |
dataset_name = "amu-cai/pl-asr-bigos-v2" | |
#dataset_secret = "amu-cai/pl-asr-bigos-v2-secret" | |
dataset_short_name = "BIGOS" | |
dataset_version = "V2" | |
dataset_configs = get_dataset_config_names(dataset_name,trust_remote_code=True) | |
# remove "all" subset, which is always the last config type | |
dataset_configs.pop() | |
print(dataset_configs) | |
# read the reports for public and secret datasets | |
[stats_dict_public, contents_dict_public] = read_reports(dataset_name) | |
# update the metrics for test split with the secret dataset statistics | |
#stats_dict_public = add_test_split_stats_from_secret_dataset(stats_dict_public, stats_dict_secret) | |
df_multindex_for_agg = dict_to_multindex_df(stats_dict_public, all_splits=False) | |
df_multindex_all_splits = dict_to_multindex_df(stats_dict_public, all_splits=True) | |
# extract metrics from dictionary and convert to various dataframes for easier analysis and visualization | |
#st.header("Summary statistics") | |
st.header("Dataset level metrics") | |
metrics_size = ["samples", "audio[h]", "speakers", "words", "chars"] | |
df_sum_stats_agg = extract_stats_to_agg(df_multindex_for_agg, metrics_size) | |
# split dataframe into separate dataframes for easier analysis and visualization | |
st.subheader("Dataset size (audio)") | |
df_sum_stats_audio = df_sum_stats_agg[["audio[h]", "samples", "speakers"]] | |
st.dataframe(df_sum_stats_audio) | |
st.subheader("Dataset size (text)") | |
df_sum_stats_text = df_sum_stats_agg[["samples", "words", "chars"]] | |
st.dataframe(df_sum_stats_text) | |
metrics_features = ["utts_unique", "words_unique", "chars_unique", "words_per_sec", "chars_per_sec"] | |
df_sum_stats_all_splits = extract_stats_all_splits(df_multindex_all_splits, metrics_features) | |
st.subheader("Dataset features (text)") | |
df_sum_stats_feats_text = df_sum_stats_all_splits[metrics_features[0:2]] | |
st.dataframe(df_sum_stats_feats_text) | |
st.subheader("Dataset features (audio)") | |
df_sum_stats_feats_audio = df_sum_stats_all_splits[metrics_features[3:]] | |
st.dataframe(df_sum_stats_feats_audio) | |
st.header("BIGOS subsets (source datasets) cards") | |
for subset in dataset_configs: | |
st.subheader("Dataset card for: {}".format(subset)) | |
df_metrics_subset_size = extract_stats_for_dataset_card(df_multindex_for_agg, subset, metrics_size, add_total=True) | |
st.dataframe(df_metrics_subset_size) | |
df_metrics_subset_features = extract_stats_for_dataset_card(df_multindex_for_agg, subset, metrics_features, add_total=False) | |
st.dataframe(df_metrics_subset_features) | |
#########################################PELCRA################################################ | |
with analysis_bigos_pelcra: | |
dataset_name = "pelcra/pl-asr-pelcra-for-bigos" | |
#dataset_secret = "pelcra/pl-asr-pelcra-for-bigos-secret" | |
dataset_short_name = "PELCRA" | |
dataset_configs = get_dataset_config_names(dataset_name,trust_remote_code=True) | |
# remove "all" subset, which is always the last config type | |
dataset_configs.pop() | |
print(dataset_configs) | |
# read the reports for public and secret datasets | |
[stats_dict_public, contents_dict_public] = read_reports(dataset_name) | |
# update the metrics for test split with the secret dataset statistics | |
#stats_dict_public = add_test_split_stats_from_secret_dataset(stats_dict_public, stats_dict_secret) | |
df_multindex_for_agg = dict_to_multindex_df(stats_dict_public, all_splits=False) | |
df_multindex_all_splits = dict_to_multindex_df(stats_dict_public, all_splits=True) | |
# extract metrics from dictionary and convert to various dataframes for easier analysis and visualization | |
#st.header("Summary statistics") | |
st.header("Dataset level metrics") | |
metrics_size = ["samples", "audio[h]", "speakers", "words", "chars"] | |
df_sum_stats_agg = extract_stats_to_agg(df_multindex_for_agg, metrics_size) | |
#st.dataframe(df_sum_stats_agg) | |
#print(df_sum_stats.columns) | |
# split dataframe into separate dataframes for easier analysis and visualization | |
st.subheader("Dataset size (audio)") | |
df_sum_stats_audio = df_sum_stats_agg[["audio[h]", "samples", "speakers"]] | |
st.dataframe(df_sum_stats_audio) | |
st.subheader("Dataset size (text)") | |
df_sum_stats_text = df_sum_stats_agg[["samples", "words", "chars"]] | |
st.dataframe(df_sum_stats_text) | |
metrics_features = ["utts_unique", "words_unique", "chars_unique", "words_per_sec", "chars_per_sec"] | |
df_sum_stats_all_splits = extract_stats_all_splits(df_multindex_all_splits, metrics_features) | |
st.subheader("Dataset features (text)") | |
df_sum_stats_feats_text = df_sum_stats_all_splits[metrics_features[0:2]] | |
st.dataframe(df_sum_stats_feats_text) | |
st.subheader("Dataset features (audio)") | |
df_sum_stats_feats_audio = df_sum_stats_all_splits[metrics_features[3:]] | |
st.dataframe(df_sum_stats_feats_audio) | |
st.header("BIGOS subsets (source datasets) cards") | |
for subset in dataset_configs: | |
st.subheader("Dataset card for: {}".format(subset)) | |
df_metrics_subset_size = extract_stats_for_dataset_card(df_multindex_for_agg, subset, metrics_size, add_total=True) | |
st.dataframe(df_metrics_subset_size) | |
df_metrics_subset_features = extract_stats_for_dataset_card(df_multindex_for_agg, subset, metrics_features, add_total=False) | |
st.dataframe(df_metrics_subset_features) | |