Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Adding api based models
#35
by
Steveeeeeeen
HF Staff
- opened
- app.py +31 -6
- utils_display.py +21 -1
app.py
CHANGED
|
@@ -6,7 +6,7 @@ from init import is_model_on_hub, upload_file, load_all_info_from_dataset_hub
|
|
| 6 |
from utils_display import AutoEvalColumn, fields, make_clickable_model, styled_error, styled_message
|
| 7 |
from datetime import datetime, timezone
|
| 8 |
|
| 9 |
-
LAST_UPDATED = "
|
| 10 |
|
| 11 |
column_names = {
|
| 12 |
"MODEL": "Model",
|
|
@@ -26,14 +26,14 @@ eval_queue_repo, requested_models, csv_results = load_all_info_from_dataset_hub(
|
|
| 26 |
|
| 27 |
if not csv_results.exists():
|
| 28 |
raise Exception(f"CSV file {csv_results} does not exist locally")
|
| 29 |
-
|
| 30 |
# Get csv with data and parse columns
|
| 31 |
original_df = pd.read_csv(csv_results)
|
| 32 |
-
|
| 33 |
# Formats the columns
|
| 34 |
def formatter(x):
|
| 35 |
if type(x) is str:
|
| 36 |
x = x
|
|
|
|
|
|
|
| 37 |
else:
|
| 38 |
x = round(x, 2)
|
| 39 |
return x
|
|
@@ -43,7 +43,6 @@ for col in original_df.columns:
|
|
| 43 |
original_df[col] = original_df[col].apply(lambda x: x.replace(x, make_clickable_model(x)))
|
| 44 |
else:
|
| 45 |
original_df[col] = original_df[col].apply(formatter) # For numerical values
|
| 46 |
-
|
| 47 |
original_df.rename(columns=column_names, inplace=True)
|
| 48 |
original_df.sort_values(by='Average WER β¬οΈ', inplace=True)
|
| 49 |
|
|
@@ -102,6 +101,16 @@ def request_model(model_text, chbcoco2017):
|
|
| 102 |
except Exception as e:
|
| 103 |
return styled_error(f"Error submitting request!")
|
| 104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
with gr.Blocks(css=LEADERBOARD_CSS) as demo:
|
| 106 |
gr.HTML(BANNER, elem_id="banner")
|
| 107 |
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
|
@@ -114,12 +123,25 @@ with gr.Blocks(css=LEADERBOARD_CSS) as demo:
|
|
| 114 |
elem_id="leaderboard-table",
|
| 115 |
interactive=False,
|
| 116 |
visible=True,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
-
with gr.TabItem("π Metrics", elem_id="od-benchmark-tab-table", id=
|
| 120 |
gr.Markdown(METRICS_TAB_TEXT, elem_classes="markdown-text")
|
| 121 |
|
| 122 |
-
with gr.TabItem("βοΈβ¨ Request a model here!", elem_id="od-benchmark-tab-table", id=
|
| 123 |
with gr.Column():
|
| 124 |
gr.Markdown("# βοΈβ¨ Request results for a new model here!", elem_classes="markdown-text")
|
| 125 |
with gr.Column():
|
|
@@ -133,6 +155,9 @@ with gr.Blocks(css=LEADERBOARD_CSS) as demo:
|
|
| 133 |
btn_submitt.click(request_model,
|
| 134 |
[model_name_textbox, chb_coco2017],
|
| 135 |
mdw_submission_result)
|
|
|
|
|
|
|
|
|
|
| 136 |
|
| 137 |
gr.Markdown(f"Last updated on **{LAST_UPDATED}**", elem_classes="markdown-text")
|
| 138 |
|
|
|
|
| 6 |
from utils_display import AutoEvalColumn, fields, make_clickable_model, styled_error, styled_message
|
| 7 |
from datetime import datetime, timezone
|
| 8 |
|
| 9 |
+
LAST_UPDATED = "Apr 8th 2025"
|
| 10 |
|
| 11 |
column_names = {
|
| 12 |
"MODEL": "Model",
|
|
|
|
| 26 |
|
| 27 |
if not csv_results.exists():
|
| 28 |
raise Exception(f"CSV file {csv_results} does not exist locally")
|
|
|
|
| 29 |
# Get csv with data and parse columns
|
| 30 |
original_df = pd.read_csv(csv_results)
|
|
|
|
| 31 |
# Formats the columns
|
| 32 |
def formatter(x):
|
| 33 |
if type(x) is str:
|
| 34 |
x = x
|
| 35 |
+
elif x == -1:
|
| 36 |
+
x = "NA"
|
| 37 |
else:
|
| 38 |
x = round(x, 2)
|
| 39 |
return x
|
|
|
|
| 43 |
original_df[col] = original_df[col].apply(lambda x: x.replace(x, make_clickable_model(x)))
|
| 44 |
else:
|
| 45 |
original_df[col] = original_df[col].apply(formatter) # For numerical values
|
|
|
|
| 46 |
original_df.rename(columns=column_names, inplace=True)
|
| 47 |
original_df.sort_values(by='Average WER β¬οΈ', inplace=True)
|
| 48 |
|
|
|
|
| 101 |
except Exception as e:
|
| 102 |
return styled_error(f"Error submitting request!")
|
| 103 |
|
| 104 |
+
def filter_main_table(show_proprietary=True):
|
| 105 |
+
filtered_df = original_df.copy()
|
| 106 |
+
|
| 107 |
+
# Filter proprietary models if needed
|
| 108 |
+
if not show_proprietary and "License" in filtered_df.columns:
|
| 109 |
+
# Keep only models with "Open" license
|
| 110 |
+
filtered_df = filtered_df[filtered_df["License"] == "Open"]
|
| 111 |
+
|
| 112 |
+
return filtered_df
|
| 113 |
+
|
| 114 |
with gr.Blocks(css=LEADERBOARD_CSS) as demo:
|
| 115 |
gr.HTML(BANNER, elem_id="banner")
|
| 116 |
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
|
|
|
| 123 |
elem_id="leaderboard-table",
|
| 124 |
interactive=False,
|
| 125 |
visible=True,
|
| 126 |
+
)
|
| 127 |
+
with gr.Row():
|
| 128 |
+
show_proprietary_checkbox = gr.Checkbox(
|
| 129 |
+
label="Show proprietary models",
|
| 130 |
+
value=True,
|
| 131 |
+
elem_id="show-proprietary-checkbox"
|
| 132 |
)
|
| 133 |
+
|
| 134 |
+
# Connect checkbox to the filtering function
|
| 135 |
+
show_proprietary_checkbox.change(
|
| 136 |
+
filter_main_table,
|
| 137 |
+
inputs=[show_proprietary_checkbox],
|
| 138 |
+
outputs=leaderboard_table
|
| 139 |
+
)
|
| 140 |
|
| 141 |
+
with gr.TabItem("π Metrics", elem_id="od-benchmark-tab-table", id=2):
|
| 142 |
gr.Markdown(METRICS_TAB_TEXT, elem_classes="markdown-text")
|
| 143 |
|
| 144 |
+
with gr.TabItem("βοΈβ¨ Request a model here!", elem_id="od-benchmark-tab-table", id=3):
|
| 145 |
with gr.Column():
|
| 146 |
gr.Markdown("# βοΈβ¨ Request results for a new model here!", elem_classes="markdown-text")
|
| 147 |
with gr.Column():
|
|
|
|
| 155 |
btn_submitt.click(request_model,
|
| 156 |
[model_name_textbox, chb_coco2017],
|
| 157 |
mdw_submission_result)
|
| 158 |
+
# add an about section
|
| 159 |
+
with gr.TabItem("π€ About", elem_id="od-benchmark-tab-table", id=4):
|
| 160 |
+
gr.Markdown("## About", elem_classes="markdown-text")
|
| 161 |
|
| 162 |
gr.Markdown(f"Last updated on **{LAST_UPDATED}**", elem_classes="markdown-text")
|
| 163 |
|
utils_display.py
CHANGED
|
@@ -26,7 +26,27 @@ class AutoEvalColumn: # Auto evals column
|
|
| 26 |
|
| 27 |
|
| 28 |
def make_clickable_model(model_name):
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">{model_name}</a>'
|
| 31 |
|
| 32 |
def styled_error(error):
|
|
|
|
| 26 |
|
| 27 |
|
| 28 |
def make_clickable_model(model_name):
|
| 29 |
+
model_name_list = model_name.split("/")
|
| 30 |
+
if model_name_list[0] == "trt-llm":
|
| 31 |
+
link = "https://github.com/NVIDIA/TensorRT-LLM/tree/main/examples/whisper"
|
| 32 |
+
elif model_name_list[0] == "faster-whisper":
|
| 33 |
+
link = "https://github.com/guillaumekln/faster-whisper"
|
| 34 |
+
elif model_name_list[0] == "Whisper.cpp":
|
| 35 |
+
link = "https://github.com/ggerganov/whisper.cpp"
|
| 36 |
+
elif model_name_list[0] == "WhisperKit":
|
| 37 |
+
link = "https://github.com/argmaxinc/WhisperKit"
|
| 38 |
+
elif model_name_list[0] == "WhisperMLX":
|
| 39 |
+
link = "https://huggingface.co/collections/mlx-community/whisper-663256f9964fbb1177db93dc"
|
| 40 |
+
elif model_name_list[0] == "elevenlabs":
|
| 41 |
+
link = "https://elevenlabs.io/speech-to-text"
|
| 42 |
+
elif model_name_list[0] == "openai" and (model_name_list[1] == "whisper-1" or model_name_list[1] == "gpt-4o-transcribe" or model_name_list[1] == "gpt-4o-mini-transcribe"):
|
| 43 |
+
link = "https://platform.openai.com/docs/guides/speech-to-text"
|
| 44 |
+
elif model_name_list[0] == "assemblyai":
|
| 45 |
+
link = "https://www.assemblyai.com/docs"
|
| 46 |
+
elif model_name_list[0] == "revai":
|
| 47 |
+
link = "https://docs.rev.ai/api/asynchronous/get-started/"
|
| 48 |
+
else:
|
| 49 |
+
link = f"https://huggingface.co/{model_name}"
|
| 50 |
return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">{model_name}</a>'
|
| 51 |
|
| 52 |
def styled_error(error):
|