Spaces:
Runtime error
Runtime error
Commit
·
a0d87da
1
Parent(s):
8ecf7e6
Multi-metric models
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import requests
|
|
| 2 |
import pandas as pd
|
| 3 |
from tqdm.auto import tqdm
|
| 4 |
import streamlit as st
|
| 5 |
-
from huggingface_hub import HfApi, hf_hub_download
|
| 6 |
from huggingface_hub.repocard import metadata_load
|
| 7 |
|
| 8 |
cer_langs = ["ja", "zh-CN", "zh-HK", "zh-TW"]
|
|
@@ -48,7 +48,7 @@ def parse_metric_value(value):
|
|
| 48 |
return value
|
| 49 |
|
| 50 |
|
| 51 |
-
def
|
| 52 |
if "model-index" not in meta or "language" not in meta:
|
| 53 |
return None
|
| 54 |
lang = meta["language"]
|
|
@@ -72,8 +72,7 @@ def parse_metrics_row(meta):
|
|
| 72 |
# overwrite the metric if the new value is lower (e.g. with LM)
|
| 73 |
row[type] = value
|
| 74 |
if "wer" in row or "cer" in row:
|
| 75 |
-
|
| 76 |
-
return None
|
| 77 |
|
| 78 |
|
| 79 |
@st.cache(ttl=600)
|
|
@@ -84,11 +83,11 @@ def get_data():
|
|
| 84 |
meta = get_metadata(model_id)
|
| 85 |
if meta is None:
|
| 86 |
continue
|
| 87 |
-
row
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
return pd.DataFrame.from_records(data)
|
| 93 |
|
| 94 |
|
|
|
|
| 2 |
import pandas as pd
|
| 3 |
from tqdm.auto import tqdm
|
| 4 |
import streamlit as st
|
| 5 |
+
from huggingface_hub import HfApi, hf_hub_download,
|
| 6 |
from huggingface_hub.repocard import metadata_load
|
| 7 |
|
| 8 |
cer_langs = ["ja", "zh-CN", "zh-HK", "zh-TW"]
|
|
|
|
| 48 |
return value
|
| 49 |
|
| 50 |
|
| 51 |
+
def parse_metrics_rows(meta):
|
| 52 |
if "model-index" not in meta or "language" not in meta:
|
| 53 |
return None
|
| 54 |
lang = meta["language"]
|
|
|
|
| 72 |
# overwrite the metric if the new value is lower (e.g. with LM)
|
| 73 |
row[type] = value
|
| 74 |
if "wer" in row or "cer" in row:
|
| 75 |
+
yield row
|
|
|
|
| 76 |
|
| 77 |
|
| 78 |
@st.cache(ttl=600)
|
|
|
|
| 83 |
meta = get_metadata(model_id)
|
| 84 |
if meta is None:
|
| 85 |
continue
|
| 86 |
+
for row in parse_metrics_rows(meta):
|
| 87 |
+
if row is None:
|
| 88 |
+
continue
|
| 89 |
+
row["model_id"] = model_id
|
| 90 |
+
data.append(row)
|
| 91 |
return pd.DataFrame.from_records(data)
|
| 92 |
|
| 93 |
|