Spaces:
Running
Running
File size: 6,459 Bytes
32fbd07 |
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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
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)
|