Spaces:
Runtime error
Runtime error
Commit ·
7feaac0
1
Parent(s): ed12281
add long form tab
Browse files- app.py +53 -5
- constants.py +13 -0
- utils_display.py +8 -0
app.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
import json
|
| 4 |
-
from constants import BANNER, INTRODUCTION_TEXT, CITATION_TEXT, METRICS_TAB_TEXT, DIR_OUTPUT_REQUESTS, LEADERBOARD_CSS, EU_LANGUAGES, MULTILINGUAL_TAB_TEXT
|
| 5 |
from init import is_model_on_hub, upload_file, load_all_info_from_dataset_hub
|
| 6 |
-
from utils_display import AutoEvalColumn, MultilingualColumn, fields, make_clickable_model, styled_error, styled_message
|
| 7 |
import numpy as np
|
| 8 |
from datetime import datetime, timezone
|
| 9 |
|
|
@@ -57,6 +57,10 @@ TYPES = [c.type for c in fields(AutoEvalColumn)]
|
|
| 57 |
# Multilingual columns (dynamic based on expansion state)
|
| 58 |
MULTILINGUAL_COLS = [c.name for c in fields(MultilingualColumn)]
|
| 59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
def create_multilingual_dataframe():
|
| 61 |
"""Create multilingual dataframe with CoVoST, MLS, and FLEURS benchmark data"""
|
| 62 |
global benchmark_details, expanded_languages
|
|
@@ -225,6 +229,39 @@ def toggle_language_expansion(language_code):
|
|
| 225 |
# Initialize multilingual dataframe
|
| 226 |
multilingual_df = create_multilingual_dataframe()
|
| 227 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 228 |
|
| 229 |
def request_model(model_text, chbcoco2017):
|
| 230 |
|
|
@@ -363,10 +400,21 @@ with gr.Blocks(css=LEADERBOARD_CSS) as demo:
|
|
| 363 |
outputs=[multilingual_table]
|
| 364 |
)
|
| 365 |
|
| 366 |
-
with gr.TabItem("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 367 |
gr.Markdown(METRICS_TAB_TEXT, elem_classes="markdown-text")
|
| 368 |
|
| 369 |
-
with gr.TabItem("✉️✨ Request a model here!", elem_id="od-benchmark-tab-table", id=
|
| 370 |
with gr.Column():
|
| 371 |
gr.Markdown("# ✉️✨ Request results for a new model here!", elem_classes="markdown-text")
|
| 372 |
with gr.Column():
|
|
@@ -381,7 +429,7 @@ with gr.Blocks(css=LEADERBOARD_CSS) as demo:
|
|
| 381 |
[model_name_textbox, chb_coco2017],
|
| 382 |
mdw_submission_result)
|
| 383 |
# add an about section
|
| 384 |
-
with gr.TabItem("🤗 About", elem_id="od-benchmark-tab-table", id=
|
| 385 |
gr.Markdown("## About", elem_classes="markdown-text")
|
| 386 |
|
| 387 |
gr.Markdown(f"Last updated on **{LAST_UPDATED}**", elem_classes="markdown-text")
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
import json
|
| 4 |
+
from constants import BANNER, INTRODUCTION_TEXT, CITATION_TEXT, METRICS_TAB_TEXT, DIR_OUTPUT_REQUESTS, LEADERBOARD_CSS, EU_LANGUAGES, MULTILINGUAL_TAB_TEXT, LONGFORM_TAB_TEXT
|
| 5 |
from init import is_model_on_hub, upload_file, load_all_info_from_dataset_hub
|
| 6 |
+
from utils_display import AutoEvalColumn, MultilingualColumn, LongformColumn, fields, make_clickable_model, styled_error, styled_message
|
| 7 |
import numpy as np
|
| 8 |
from datetime import datetime, timezone
|
| 9 |
|
|
|
|
| 57 |
# Multilingual columns (dynamic based on expansion state)
|
| 58 |
MULTILINGUAL_COLS = [c.name for c in fields(MultilingualColumn)]
|
| 59 |
|
| 60 |
+
# Longform columns
|
| 61 |
+
LONGFORM_COLS = [c.name for c in fields(LongformColumn)]
|
| 62 |
+
LONGFORM_TYPES = [c.type for c in fields(LongformColumn)]
|
| 63 |
+
|
| 64 |
def create_multilingual_dataframe():
|
| 65 |
"""Create multilingual dataframe with CoVoST, MLS, and FLEURS benchmark data"""
|
| 66 |
global benchmark_details, expanded_languages
|
|
|
|
| 229 |
# Initialize multilingual dataframe
|
| 230 |
multilingual_df = create_multilingual_dataframe()
|
| 231 |
|
| 232 |
+
def create_longform_dataframe():
|
| 233 |
+
"""Create longform dataframe with sample data for Earnings21 and MustC datasets"""
|
| 234 |
+
longform_data = []
|
| 235 |
+
|
| 236 |
+
# Sample data with realistic WER values for longform tasks (generally higher than short-form)
|
| 237 |
+
sample_models = [
|
| 238 |
+
{"model": "openai/whisper-large-v3", "earnings21": 8.2, "mustc": 12.4, "rtfx": 2.1},
|
| 239 |
+
{"model": "openai/whisper-large-v2", "earnings21": 9.1, "mustc": 13.8, "rtfx": 1.8},
|
| 240 |
+
{"model": "nvidia/canary-1b", "earnings21": 7.5, "mustc": 11.2, "rtfx": 3.2},
|
| 241 |
+
{"model": "microsoft/speecht5_asr", "earnings21": 15.3, "mustc": 18.7, "rtfx": 1.4},
|
| 242 |
+
{"model": "facebook/wav2vec2-large-960h", "earnings21": 12.4, "mustc": 16.8, "rtfx": 0.8},
|
| 243 |
+
{"model": "assemblyai/conformer-1", "earnings21": 6.8, "mustc": 10.1, "rtfx": 2.8},
|
| 244 |
+
{"model": "speechmatics/en", "earnings21": 5.9, "mustc": 9.3, "rtfx": 3.5},
|
| 245 |
+
{"model": "revai/english", "earnings21": 6.2, "mustc": 9.8, "rtfx": 2.9},
|
| 246 |
+
]
|
| 247 |
+
|
| 248 |
+
for model_data in sample_models:
|
| 249 |
+
row = {
|
| 250 |
+
"Model": make_clickable_model(model_data["model"]),
|
| 251 |
+
"Average WER ⬇️": round((model_data["earnings21"] + model_data["mustc"]) / 2, 2),
|
| 252 |
+
"RTFx ⬆️️": model_data["rtfx"] if model_data["rtfx"] > 0 else "NA",
|
| 253 |
+
"Earnings21": model_data["earnings21"],
|
| 254 |
+
"MustC": model_data["mustc"]
|
| 255 |
+
}
|
| 256 |
+
longform_data.append(row)
|
| 257 |
+
|
| 258 |
+
longform_df = pd.DataFrame(longform_data)
|
| 259 |
+
longform_df = longform_df.sort_values(by='Average WER ⬇️')
|
| 260 |
+
return longform_df
|
| 261 |
+
|
| 262 |
+
# Initialize longform dataframe
|
| 263 |
+
longform_df = create_longform_dataframe()
|
| 264 |
+
|
| 265 |
|
| 266 |
def request_model(model_text, chbcoco2017):
|
| 267 |
|
|
|
|
| 400 |
outputs=[multilingual_table]
|
| 401 |
)
|
| 402 |
|
| 403 |
+
with gr.TabItem("📝 Long-form", elem_id="longform-benchmark-tab-table", id=2):
|
| 404 |
+
gr.Markdown(LONGFORM_TAB_TEXT, elem_classes="markdown-text")
|
| 405 |
+
|
| 406 |
+
longform_table = gr.components.Dataframe(
|
| 407 |
+
value=longform_df,
|
| 408 |
+
datatype=LONGFORM_TYPES,
|
| 409 |
+
elem_id="longform-table",
|
| 410 |
+
interactive=False,
|
| 411 |
+
visible=True,
|
| 412 |
+
)
|
| 413 |
+
|
| 414 |
+
with gr.TabItem("📈 Metrics", elem_id="od-benchmark-tab-table", id=4):
|
| 415 |
gr.Markdown(METRICS_TAB_TEXT, elem_classes="markdown-text")
|
| 416 |
|
| 417 |
+
with gr.TabItem("✉️✨ Request a model here!", elem_id="od-benchmark-tab-table", id=5):
|
| 418 |
with gr.Column():
|
| 419 |
gr.Markdown("# ✉️✨ Request results for a new model here!", elem_classes="markdown-text")
|
| 420 |
with gr.Column():
|
|
|
|
| 429 |
[model_name_textbox, chb_coco2017],
|
| 430 |
mdw_submission_result)
|
| 431 |
# add an about section
|
| 432 |
+
with gr.TabItem("🤗 About", elem_id="od-benchmark-tab-table", id=6):
|
| 433 |
gr.Markdown("## About", elem_classes="markdown-text")
|
| 434 |
|
| 435 |
gr.Markdown(f"Last updated on **{LAST_UPDATED}**", elem_classes="markdown-text")
|
constants.py
CHANGED
|
@@ -128,6 +128,11 @@ MULTILINGUAL_TAB_TEXT = """
|
|
| 128 |
|
| 129 |
"""
|
| 130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
LEADERBOARD_CSS = """
|
| 132 |
#leaderboard-table th .header-content {
|
| 133 |
white-space: nowrap;
|
|
@@ -141,6 +146,14 @@ LEADERBOARD_CSS = """
|
|
| 141 |
background-color: var(--table-row-focus);
|
| 142 |
}
|
| 143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
.language-detail-modal {
|
| 145 |
background: var(--background-fill-primary);
|
| 146 |
border: 1px solid var(--border-color-primary);
|
|
|
|
| 128 |
|
| 129 |
"""
|
| 130 |
|
| 131 |
+
LONGFORM_TAB_TEXT = """
|
| 132 |
+
## 📝 Long-form ASR Evaluation
|
| 133 |
+
|
| 134 |
+
"""
|
| 135 |
+
|
| 136 |
LEADERBOARD_CSS = """
|
| 137 |
#leaderboard-table th .header-content {
|
| 138 |
white-space: nowrap;
|
|
|
|
| 146 |
background-color: var(--table-row-focus);
|
| 147 |
}
|
| 148 |
|
| 149 |
+
#longform-table th .header-content {
|
| 150 |
+
white-space: nowrap;
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
#longform-table th:hover {
|
| 154 |
+
background-color: var(--table-row-focus);
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
.language-detail-modal {
|
| 158 |
background: var(--background-fill-primary);
|
| 159 |
border: 1px solid var(--border-color-primary);
|
utils_display.py
CHANGED
|
@@ -40,6 +40,14 @@ class MultilingualColumn: # Multilingual benchmark columns
|
|
| 40 |
ro_avg = ColumnContent("🇷🇴 Romanian", "number")
|
| 41 |
hu_avg = ColumnContent("🇭🇺 Hungarian", "number")
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
def make_clickable_model(model_name):
|
| 45 |
model_name_list = model_name.split("/")
|
|
|
|
| 40 |
ro_avg = ColumnContent("🇷🇴 Romanian", "number")
|
| 41 |
hu_avg = ColumnContent("🇭🇺 Hungarian", "number")
|
| 42 |
|
| 43 |
+
@dataclass(frozen=True)
|
| 44 |
+
class LongformColumn: # Long-form ASR benchmark columns
|
| 45 |
+
model = ColumnContent("Model", "markdown")
|
| 46 |
+
avg_longform = ColumnContent("Average WER ⬇️", "number")
|
| 47 |
+
rtf = ColumnContent("RTFx ⬆️️", "number")
|
| 48 |
+
earnings21_wer = ColumnContent("Earnings21", "number")
|
| 49 |
+
mustc_wer = ColumnContent("MustC", "number")
|
| 50 |
+
|
| 51 |
|
| 52 |
def make_clickable_model(model_name):
|
| 53 |
model_name_list = model_name.split("/")
|