Spaces:
Runtime error
Runtime error
Commit
·
b2a3e8a
0
Parent(s):
Duplicate from sanchit-gandhi/leaderboards
Browse filesCo-authored-by: Sanchit Gandhi <sanchit-gandhi@users.noreply.huggingface.co>
README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Leaderboards
|
| 3 |
+
emoji: 📈
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: yellow
|
| 6 |
+
sdk: streamlit
|
| 7 |
+
sdk_version: 1.10.0
|
| 8 |
+
python_version: 3.8.9
|
| 9 |
+
app_file: app.py
|
| 10 |
+
pinned: false
|
| 11 |
+
license: apache-2.0
|
| 12 |
+
duplicated_from: sanchit-gandhi/leaderboards
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces#reference
|
app.py
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pandas as pd
|
| 2 |
+
import streamlit as st
|
| 3 |
+
from huggingface_hub import HfApi
|
| 4 |
+
from utils import ascending_metrics, metric_ranges, CV11_LANGUAGES, FLEURS_LANGUAGES
|
| 5 |
+
import numpy as np
|
| 6 |
+
from st_aggrid import AgGrid, GridOptionsBuilder, JsCode
|
| 7 |
+
from os.path import exists
|
| 8 |
+
import threading
|
| 9 |
+
|
| 10 |
+
st.set_page_config(layout="wide")
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def get_model_infos():
|
| 14 |
+
api = HfApi()
|
| 15 |
+
model_infos = api.list_models(filter="model-index", cardData=True)
|
| 16 |
+
return model_infos
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def parse_metric_value(value):
|
| 20 |
+
if isinstance(value, str):
|
| 21 |
+
"".join(value.split("%"))
|
| 22 |
+
try:
|
| 23 |
+
value = float(value)
|
| 24 |
+
except: # noqa: E722
|
| 25 |
+
value = None
|
| 26 |
+
elif isinstance(value, list):
|
| 27 |
+
if len(value) > 0:
|
| 28 |
+
value = value[0]
|
| 29 |
+
else:
|
| 30 |
+
value = None
|
| 31 |
+
value = round(value, 4) if isinstance(value, float) else None
|
| 32 |
+
return value
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def parse_metrics_rows(meta, only_verified=False):
|
| 36 |
+
if not isinstance(meta["model-index"], list) or len(meta["model-index"]) == 0 or "results" not in meta["model-index"][0]:
|
| 37 |
+
return None
|
| 38 |
+
for result in meta["model-index"][0]["results"]:
|
| 39 |
+
if not isinstance(result, dict) or "dataset" not in result or "metrics" not in result or "type" not in result["dataset"]:
|
| 40 |
+
continue
|
| 41 |
+
dataset = result["dataset"]["type"]
|
| 42 |
+
if dataset == "":
|
| 43 |
+
continue
|
| 44 |
+
row = {"dataset": dataset, "split": "-unspecified-", "config": "-unspecified-"}
|
| 45 |
+
if "split" in result["dataset"]:
|
| 46 |
+
row["split"] = result["dataset"]["split"]
|
| 47 |
+
if "config" in result["dataset"]:
|
| 48 |
+
row["config"] = result["dataset"]["config"]
|
| 49 |
+
no_results = True
|
| 50 |
+
incorrect_results = False
|
| 51 |
+
for metric in result["metrics"]:
|
| 52 |
+
name = metric["type"].lower().strip()
|
| 53 |
+
|
| 54 |
+
if name in ("model_id", "dataset", "split", "config", "pipeline_tag", "only_verified"):
|
| 55 |
+
# Metrics are not allowed to be named "dataset", "split", "config", "pipeline_tag"
|
| 56 |
+
continue
|
| 57 |
+
value = parse_metric_value(metric.get("value", None))
|
| 58 |
+
if value is None:
|
| 59 |
+
continue
|
| 60 |
+
if name in row:
|
| 61 |
+
new_metric_better = value < row[name] if name in ascending_metrics else value > row[name]
|
| 62 |
+
if name not in row or new_metric_better:
|
| 63 |
+
# overwrite the metric if the new value is better.
|
| 64 |
+
|
| 65 |
+
if only_verified:
|
| 66 |
+
if "verified" in metric and metric["verified"]:
|
| 67 |
+
no_results = False
|
| 68 |
+
row[name] = value
|
| 69 |
+
if name in metric_ranges:
|
| 70 |
+
if value < metric_ranges[name][0] or value > metric_ranges[name][1]:
|
| 71 |
+
incorrect_results = True
|
| 72 |
+
else:
|
| 73 |
+
no_results = False
|
| 74 |
+
row[name] = value
|
| 75 |
+
if name in metric_ranges:
|
| 76 |
+
if value < metric_ranges[name][0] or value > metric_ranges[name][1]:
|
| 77 |
+
incorrect_results = True
|
| 78 |
+
if no_results or incorrect_results:
|
| 79 |
+
continue
|
| 80 |
+
yield row
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
@st.cache(ttl=0)
|
| 84 |
+
def get_data_wrapper():
|
| 85 |
+
def get_data(dataframe=None, verified_dataframe=None):
|
| 86 |
+
data = []
|
| 87 |
+
verified_data = []
|
| 88 |
+
print("getting model infos")
|
| 89 |
+
model_infos = get_model_infos()
|
| 90 |
+
print("got model infos")
|
| 91 |
+
for model_info in model_infos:
|
| 92 |
+
meta = model_info.cardData
|
| 93 |
+
if meta is None:
|
| 94 |
+
continue
|
| 95 |
+
for row in parse_metrics_rows(meta):
|
| 96 |
+
if row is None:
|
| 97 |
+
continue
|
| 98 |
+
row["model_id"] = model_info.id
|
| 99 |
+
row["pipeline_tag"] = model_info.pipeline_tag
|
| 100 |
+
row["only_verified"] = False
|
| 101 |
+
data.append(row)
|
| 102 |
+
for row in parse_metrics_rows(meta, only_verified=True):
|
| 103 |
+
if row is None:
|
| 104 |
+
continue
|
| 105 |
+
row["model_id"] = model_info.id
|
| 106 |
+
row["pipeline_tag"] = model_info.pipeline_tag
|
| 107 |
+
row["only_verified"] = True
|
| 108 |
+
data.append(row)
|
| 109 |
+
dataframe = pd.DataFrame.from_records(data)
|
| 110 |
+
dataframe.to_pickle("cache.pkl")
|
| 111 |
+
|
| 112 |
+
if exists("cache.pkl"):
|
| 113 |
+
# If we have saved the results previously, call an asynchronous process
|
| 114 |
+
# to fetch the results and update the saved file. Don't make users wait
|
| 115 |
+
# while we fetch the new results. Instead, display the old results for
|
| 116 |
+
# now. The new results should be loaded when this method
|
| 117 |
+
# is called again.
|
| 118 |
+
dataframe = pd.read_pickle("cache.pkl")
|
| 119 |
+
t = threading.Thread(name="get_data procs", target=get_data)
|
| 120 |
+
t.start()
|
| 121 |
+
else:
|
| 122 |
+
# We have to make the users wait during the first startup of this app.
|
| 123 |
+
get_data()
|
| 124 |
+
dataframe = pd.read_pickle("cache.pkl")
|
| 125 |
+
|
| 126 |
+
return dataframe
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
dataframe = get_data_wrapper()
|
| 130 |
+
|
| 131 |
+
st.markdown("# 🤗 Whisper Event: Final Leaderboard")
|
| 132 |
+
|
| 133 |
+
# query params are used to refine the browser URL as more options are selected
|
| 134 |
+
query_params = st.experimental_get_query_params()
|
| 135 |
+
if "first_query_params" not in st.session_state:
|
| 136 |
+
st.session_state.first_query_params = query_params
|
| 137 |
+
first_query_params = st.session_state.first_query_params
|
| 138 |
+
|
| 139 |
+
# define the scope of the leaderboard
|
| 140 |
+
only_verified_results = False
|
| 141 |
+
task = "automatic-speech-recognition"
|
| 142 |
+
selectable_datasets = ["mozilla-foundation/common_voice_11_0", "google/fleurs"]
|
| 143 |
+
dataset_mapping = {"mozilla-foundation/common_voice_11_0": "Common Voice 11", "google/fleurs": "FLEURS"} # get a 'pretty' name for our datasets
|
| 144 |
+
split = "test"
|
| 145 |
+
selectable_metrics = ["wer", "cer"]
|
| 146 |
+
default_metric = selectable_metrics[0]
|
| 147 |
+
|
| 148 |
+
# select dataset from list provided
|
| 149 |
+
dataset = st.sidebar.selectbox(
|
| 150 |
+
"Dataset",
|
| 151 |
+
selectable_datasets,
|
| 152 |
+
help="Select a dataset to see the leaderboard!"
|
| 153 |
+
)
|
| 154 |
+
dataset_name = dataset_mapping[dataset]
|
| 155 |
+
|
| 156 |
+
# slice dataframe to entries of interest
|
| 157 |
+
dataframe = dataframe[dataframe.only_verified == only_verified_results]
|
| 158 |
+
dataset_df = dataframe[dataframe.dataset == dataset]
|
| 159 |
+
dataset_df = dataset_df[dataset_df.split == split] # hardcoded to "test"
|
| 160 |
+
dataset_df = dataset_df.dropna(axis="columns", how="all")
|
| 161 |
+
|
| 162 |
+
# get potential dataset configs (languages)
|
| 163 |
+
selectable_configs = list(set(dataset_df["config"]))
|
| 164 |
+
selectable_configs.sort(key=lambda name: name.lower())
|
| 165 |
+
|
| 166 |
+
if "-unspecified-" in selectable_configs:
|
| 167 |
+
selectable_configs.remove("-unspecified-")
|
| 168 |
+
|
| 169 |
+
if dataset == "mozilla-foundation/common_voice_11_0":
|
| 170 |
+
selectable_configs = [config for config in selectable_configs if config in CV11_LANGUAGES]
|
| 171 |
+
visual_configs = [f"{config}: {CV11_LANGUAGES[config]}" for config in selectable_configs]
|
| 172 |
+
elif dataset == "google/fleurs":
|
| 173 |
+
selectable_configs = [config for config in selectable_configs if config in FLEURS_LANGUAGES]
|
| 174 |
+
visual_configs = [f"{config}: {FLEURS_LANGUAGES[config]}" for config in selectable_configs]
|
| 175 |
+
|
| 176 |
+
config = st.sidebar.selectbox(
|
| 177 |
+
"Language",
|
| 178 |
+
visual_configs,
|
| 179 |
+
help="Filter the results on the current leaderboard by language."
|
| 180 |
+
)
|
| 181 |
+
config, language = config.split(":")
|
| 182 |
+
|
| 183 |
+
# just for show -> we've fixed the split to "test"
|
| 184 |
+
split = st.sidebar.selectbox(
|
| 185 |
+
"Split",
|
| 186 |
+
[split],
|
| 187 |
+
index=0,
|
| 188 |
+
help="View the results for the `test` split for evaluation performance.",
|
| 189 |
+
)
|
| 190 |
+
|
| 191 |
+
# update browser URL with selections
|
| 192 |
+
current_query_params = {"dataset": [dataset], "config": [config], "split": split}
|
| 193 |
+
st.experimental_set_query_params(**current_query_params)
|
| 194 |
+
|
| 195 |
+
dataset_df = dataset_df[dataset_df.config == config]
|
| 196 |
+
|
| 197 |
+
dataset_df = dataset_df.filter(["model_id"] + (["dataset"] if dataset == "-any-" else []) + selectable_metrics)
|
| 198 |
+
dataset_df = dataset_df.dropna(thresh=2) # Want at least two non-na values (one for model_id and one for a metric).
|
| 199 |
+
|
| 200 |
+
sorting_metric = st.sidebar.radio(
|
| 201 |
+
"Sorting Metric",
|
| 202 |
+
selectable_metrics,
|
| 203 |
+
index=selectable_metrics.index(default_metric) if default_metric in selectable_metrics else 0,
|
| 204 |
+
help="Select the metric to sort the leaderboard by. Click on the metric name in the leaderboard to reverse the sorting order."
|
| 205 |
+
)
|
| 206 |
+
|
| 207 |
+
st.markdown(
|
| 208 |
+
f"This is the leaderboard for {dataset_name} {language} ({config})."
|
| 209 |
+
)
|
| 210 |
+
|
| 211 |
+
st.markdown(
|
| 212 |
+
"Please click on the model's name to be redirected to its model card."
|
| 213 |
+
)
|
| 214 |
+
|
| 215 |
+
st.markdown(
|
| 216 |
+
"Want to beat the leaderboard? Don't see your model here? Ensure..."
|
| 217 |
+
)
|
| 218 |
+
|
| 219 |
+
# Make the default metric appear right after model names and dataset names
|
| 220 |
+
cols = dataset_df.columns.tolist()
|
| 221 |
+
cols.remove(sorting_metric)
|
| 222 |
+
sorting_metric_index = 1 if dataset != "-any-" else 2
|
| 223 |
+
cols = cols[:sorting_metric_index] + [sorting_metric] + cols[sorting_metric_index:]
|
| 224 |
+
dataset_df = dataset_df[cols]
|
| 225 |
+
|
| 226 |
+
# Sort the leaderboard, giving the sorting metric highest priority and then ordering by other metrics in the case of equal values.
|
| 227 |
+
dataset_df = dataset_df.sort_values(by=cols[sorting_metric_index:], ascending=[metric in ascending_metrics for metric in cols[sorting_metric_index:]])
|
| 228 |
+
dataset_df = dataset_df.replace(np.nan, '-')
|
| 229 |
+
|
| 230 |
+
# Make the leaderboard
|
| 231 |
+
gb = GridOptionsBuilder.from_dataframe(dataset_df)
|
| 232 |
+
gb.configure_default_column(sortable=False)
|
| 233 |
+
gb.configure_column(
|
| 234 |
+
"model_id",
|
| 235 |
+
cellRenderer=JsCode('''function(params) {return '<a target="_blank" href="https://huggingface.co/'+params.value+'">'+params.value+'</a>'}'''),
|
| 236 |
+
)
|
| 237 |
+
|
| 238 |
+
for name in selectable_metrics:
|
| 239 |
+
gb.configure_column(name, type=["numericColumn", "numberColumnFilter", "customNumericFormat"], precision=2, aggFunc='sum')
|
| 240 |
+
|
| 241 |
+
gb.configure_column(
|
| 242 |
+
sorting_metric,
|
| 243 |
+
sortable=True,
|
| 244 |
+
cellStyle=JsCode('''function(params) { return {'backgroundColor': '#FFD21E'}}''')
|
| 245 |
+
)
|
| 246 |
+
|
| 247 |
+
go = gb.build()
|
| 248 |
+
fit_columns = len(dataset_df.columns) < 10
|
| 249 |
+
AgGrid(dataset_df, gridOptions=go, height=28*len(dataset_df) + (35 if fit_columns else 41), allow_unsafe_jscode=True, fit_columns_on_grid_load=fit_columns, enable_enterprise_modules=False)
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
pandas==1.5.1
|
| 2 |
+
huggingface_hub==0.11.1
|
| 3 |
+
numpy==1.23.4
|
| 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cer",
|
| 4 |
+
"loss",
|
| 5 |
+
"mae",
|
| 6 |
+
"mahalanobis",
|
| 7 |
+
"mse",
|
| 8 |
+
"perplexity",
|
| 9 |
+
"ter",
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
metric_ranges = {
|
| 13 |
+
"accuracy": (0,1),
|
| 14 |
+
"precision": (0,1),
|
| 15 |
+
"recall": (0,1),
|
| 16 |
+
"macro f1": (0,1),
|
| 17 |
+
"micro f1": (0,1),
|
| 18 |
+
"pearson": (-1, 1),
|
| 19 |
+
"matthews_correlation": (-1, 1),
|
| 20 |
+
"spearmanr": (-1, 1),
|
| 21 |
+
"google_bleu": (0, 1),
|
| 22 |
+
"precision@10": (0, 1),
|
| 23 |
+
"mae": (0, 1),
|
| 24 |
+
"mauve": (0, 1),
|
| 25 |
+
"frontier_integral": (0, 1),
|
| 26 |
+
"mean_iou": (0, 1),
|
| 27 |
+
"mean_accuracy": (0, 1),
|
| 28 |
+
"overall_accuracy": (0, 1),
|
| 29 |
+
"meteor": (0, 1),
|
| 30 |
+
"mse": (0, 1),
|
| 31 |
+
"perplexity": (0, float("inf")),
|
| 32 |
+
"rogue1": (0, 1),
|
| 33 |
+
"rogue2": (0, 1),
|
| 34 |
+
"sari": (0, 100),
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
CV11_LANGUAGES = {
|
| 38 |
+
'ab': 'Abkhaz',
|
| 39 |
+
'ace': 'Acehnese',
|
| 40 |
+
'ady': 'Adyghe',
|
| 41 |
+
'af': 'Afrikaans',
|
| 42 |
+
'am': 'Amharic',
|
| 43 |
+
'an': 'Aragonese',
|
| 44 |
+
'ar': 'Arabic',
|
| 45 |
+
'arn': 'Mapudungun',
|
| 46 |
+
'as': 'Assamese',
|
| 47 |
+
'ast': 'Asturian',
|
| 48 |
+
'az': 'Azerbaijani',
|
| 49 |
+
'ba': 'Bashkir',
|
| 50 |
+
'bas': 'Basaa',
|
| 51 |
+
'be': 'Belarusian',
|
| 52 |
+
'bg': 'Bulgarian',
|
| 53 |
+
'bn': 'Bengali',
|
| 54 |
+
'br': 'Breton',
|
| 55 |
+
'bs': 'Bosnian',
|
| 56 |
+
'bxr': 'Buryat',
|
| 57 |
+
'ca': 'Catalan',
|
| 58 |
+
'cak': 'Kaqchikel',
|
| 59 |
+
'ckb': 'Central Kurdish',
|
| 60 |
+
'cnh': 'Hakha Chin',
|
| 61 |
+
'co': 'Corsican',
|
| 62 |
+
'cs': 'Czech',
|
| 63 |
+
'cv': 'Chuvash',
|
| 64 |
+
'cy': 'Welsh',
|
| 65 |
+
'da': 'Danish',
|
| 66 |
+
'de': 'German',
|
| 67 |
+
'dsb': 'Sorbian, Lower',
|
| 68 |
+
'dv': 'Dhivehi',
|
| 69 |
+
'dyu': 'Dioula',
|
| 70 |
+
'el': 'Greek',
|
| 71 |
+
'en': 'English',
|
| 72 |
+
'eo': 'Esperanto',
|
| 73 |
+
'es': 'Spanish',
|
| 74 |
+
'et': 'Estonian',
|
| 75 |
+
'eu': 'Basque',
|
| 76 |
+
'fa': 'Persian',
|
| 77 |
+
'ff': 'Fulah',
|
| 78 |
+
'fi': 'Finnish',
|
| 79 |
+
'fo': 'Faroese',
|
| 80 |
+
'fr': 'French',
|
| 81 |
+
'fy-NL': 'Frisian',
|
| 82 |
+
'ga-IE': 'Irish',
|
| 83 |
+
'gl': 'Galician',
|
| 84 |
+
'gn': 'Guarani',
|
| 85 |
+
'gom': 'Goan Konkani',
|
| 86 |
+
'ha': 'Hausa',
|
| 87 |
+
'he': 'Hebrew',
|
| 88 |
+
'hi': 'Hindi',
|
| 89 |
+
'hil': 'Hiligaynon',
|
| 90 |
+
'hr': 'Croatian',
|
| 91 |
+
'hsb': 'Sorbian, Upper',
|
| 92 |
+
'ht': 'Haitian',
|
| 93 |
+
'hu': 'Hungarian',
|
| 94 |
+
'hy-AM': 'Armenian',
|
| 95 |
+
'hyw': 'Armenian Western',
|
| 96 |
+
'ia': 'Interlingua',
|
| 97 |
+
'id': 'Indonesian',
|
| 98 |
+
'ie': 'Interlingue',
|
| 99 |
+
'ig': 'Igbo',
|
| 100 |
+
'is': 'Icelandic',
|
| 101 |
+
'it': 'Italian',
|
| 102 |
+
'izh': 'Izhorian',
|
| 103 |
+
'ja': 'Japanese',
|
| 104 |
+
'jbo': 'Lojban',
|
| 105 |
+
'ka': 'Georgian',
|
| 106 |
+
'kaa': 'Karakalpak',
|
| 107 |
+
'kab': 'Kabyle',
|
| 108 |
+
'kbd': 'Kabardian',
|
| 109 |
+
'ki': 'Kikuyu',
|
| 110 |
+
'kk': 'Kazakh',
|
| 111 |
+
'km': 'Khmer',
|
| 112 |
+
'kmr': 'Kurmanji Kurdish',
|
| 113 |
+
'kn': 'Kannada',
|
| 114 |
+
'knn': 'Konkani (Devanagari)',
|
| 115 |
+
'ko': 'Korean',
|
| 116 |
+
'kpv': 'Komi-Zyrian',
|
| 117 |
+
'kw': 'Cornish',
|
| 118 |
+
'ky': 'Kyrgyz',
|
| 119 |
+
'lb': 'Luxembourgish',
|
| 120 |
+
'lg': 'Luganda',
|
| 121 |
+
'lij': 'Ligurian',
|
| 122 |
+
'ln': 'Lingala',
|
| 123 |
+
'lo': 'Lao',
|
| 124 |
+
'lt': 'Lithuanian',
|
| 125 |
+
'lv': 'Latvian',
|
| 126 |
+
'mai': 'Maithili',
|
| 127 |
+
'mdf': 'Moksha',
|
| 128 |
+
'mg': 'Malagasy',
|
| 129 |
+
'mhr': 'Meadow Mari',
|
| 130 |
+
'mk': 'Macedonian',
|
| 131 |
+
'ml': 'Malayalam',
|
| 132 |
+
'mn': 'Mongolian',
|
| 133 |
+
'mni': 'Meetei Lon',
|
| 134 |
+
'mos': 'Mossi',
|
| 135 |
+
'mr': 'Marathi',
|
| 136 |
+
'mrj': 'Hill Mari',
|
| 137 |
+
'ms': 'Malay',
|
| 138 |
+
'mt': 'Maltese',
|
| 139 |
+
'my': 'Burmese',
|
| 140 |
+
'myv': 'Erzya',
|
| 141 |
+
'nan-tw': 'Taiwanese (Minnan)',
|
| 142 |
+
'nb-NO': 'Norwegian Bokmål',
|
| 143 |
+
'nd': 'IsiNdebele (North)',
|
| 144 |
+
'ne-NP': 'Nepali',
|
| 145 |
+
'nia': 'Nias',
|
| 146 |
+
'nl': 'Dutch',
|
| 147 |
+
'nn-NO': 'Norwegian Nynorsk',
|
| 148 |
+
'nr': 'IsiNdebele (South)',
|
| 149 |
+
'nso': 'Northern Sotho',
|
| 150 |
+
'nyn': 'Runyankole',
|
| 151 |
+
'oc': 'Occitan',
|
| 152 |
+
'om': 'Afaan Ormoo',
|
| 153 |
+
'or': 'Odia',
|
| 154 |
+
'pa-IN': 'Punjabi',
|
| 155 |
+
'pap-AW': 'Papiamento (Aruba)',
|
| 156 |
+
'pl': 'Polish',
|
| 157 |
+
'ps': 'Pashto',
|
| 158 |
+
'pt': 'Portuguese',
|
| 159 |
+
'quc': "K'iche'",
|
| 160 |
+
'quy': 'Quechua Chanka',
|
| 161 |
+
'rm-sursilv': 'Romansh Sursilvan',
|
| 162 |
+
'rm-vallader': 'Romansh Vallader',
|
| 163 |
+
'ro': 'Romanian',
|
| 164 |
+
'ru': 'Russian',
|
| 165 |
+
'rw': 'Kinyarwanda',
|
| 166 |
+
'sah': 'Sakha',
|
| 167 |
+
'sat': 'Santali (Ol Chiki)',
|
| 168 |
+
'sc': 'Sardinian',
|
| 169 |
+
'scn': 'Sicilian',
|
| 170 |
+
'sdh': 'Southern Kurdish',
|
| 171 |
+
'shi': 'Shilha',
|
| 172 |
+
'si': 'Sinhala',
|
| 173 |
+
'sk': 'Slovak',
|
| 174 |
+
'skr': 'Saraiki',
|
| 175 |
+
'sl': 'Slovenian',
|
| 176 |
+
'snk': 'Soninke',
|
| 177 |
+
'so': 'Somali',
|
| 178 |
+
'sq': 'Albanian',
|
| 179 |
+
'sr': 'Serbian',
|
| 180 |
+
'ss': 'Siswati',
|
| 181 |
+
'st': 'Southern Sotho',
|
| 182 |
+
'sv-SE': 'Swedish',
|
| 183 |
+
'sw': 'Swahili',
|
| 184 |
+
'syr': 'Syriac',
|
| 185 |
+
'ta': 'Tamil',
|
| 186 |
+
'te': 'Telugu',
|
| 187 |
+
'tg': 'Tajik',
|
| 188 |
+
'th': 'Thai',
|
| 189 |
+
'ti': 'Tigrinya',
|
| 190 |
+
'tig': 'Tigre',
|
| 191 |
+
'tk': 'Turkmen',
|
| 192 |
+
'tl': 'Tagalog',
|
| 193 |
+
'tn': 'Setswana',
|
| 194 |
+
'tok': 'Toki Pona',
|
| 195 |
+
'tr': 'Turkish',
|
| 196 |
+
'ts': 'Xitsonga',
|
| 197 |
+
'tt': 'Tatar',
|
| 198 |
+
'tw': 'Twi',
|
| 199 |
+
'ty': 'Tahitian',
|
| 200 |
+
'uby': 'Ubykh',
|
| 201 |
+
'udm': 'Udmurt',
|
| 202 |
+
'ug': 'Uyghur',
|
| 203 |
+
'uk': 'Ukrainian',
|
| 204 |
+
'ur': 'Urdu',
|
| 205 |
+
'uz': 'Uzbek',
|
| 206 |
+
've': 'Tshivenda',
|
| 207 |
+
'vec': 'Venetian',
|
| 208 |
+
'vi': 'Vietnamese',
|
| 209 |
+
'vot': 'Votic',
|
| 210 |
+
'xh': 'Xhosa',
|
| 211 |
+
'yi': 'Yiddish',
|
| 212 |
+
'yo': 'Yoruba',
|
| 213 |
+
'yue': 'Cantonese',
|
| 214 |
+
'zgh': 'Tamazight',
|
| 215 |
+
'zh-CN': 'Chinese (China)',
|
| 216 |
+
'zh-HK': 'Chinese (Hong Kong)',
|
| 217 |
+
'zh-TW': 'Chinese (Taiwan)',
|
| 218 |
+
'zu': 'Zulu',
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
FLEURS_LANGUAGES = {
|
| 222 |
+
'af_za': 'Afrikaans',
|
| 223 |
+
'am_et': 'Amharic',
|
| 224 |
+
'ar_eg': 'Arabic',
|
| 225 |
+
'as_in': 'Assamese',
|
| 226 |
+
'ast_es': 'Asturian',
|
| 227 |
+
'az_az': 'Azerbaijani',
|
| 228 |
+
'be_by': 'Belarusian',
|
| 229 |
+
'bg_bg': 'Bulgarian',
|
| 230 |
+
'bn_in': 'Bengali',
|
| 231 |
+
'bs_ba': 'Bosnian',
|
| 232 |
+
'ca_es': 'Catalan',
|
| 233 |
+
'ceb_ph': 'Cebuano',
|
| 234 |
+
'ckb_iq': 'Sorani-Kurdish',
|
| 235 |
+
'cmn_hans_cn': 'Mandarin Chinese',
|
| 236 |
+
'cs_cz': 'Czech',
|
| 237 |
+
'cy_gb': 'Welsh',
|
| 238 |
+
'da_dk': 'Danish',
|
| 239 |
+
'de_de': 'German',
|
| 240 |
+
'el_gr': 'Greek',
|
| 241 |
+
'en_us': 'English',
|
| 242 |
+
'es_419': 'Spanish',
|
| 243 |
+
'et_ee': 'Estonian',
|
| 244 |
+
'fa_ir': 'Persian',
|
| 245 |
+
'ff_sn': 'Fula',
|
| 246 |
+
'fi_fi': 'Finnish',
|
| 247 |
+
'fil_ph': 'Filipino',
|
| 248 |
+
'fr_fr': 'French',
|
| 249 |
+
'ga_ie': 'Irish',
|
| 250 |
+
'gl_es': 'Galician',
|
| 251 |
+
'gu_in': 'Gujarati',
|
| 252 |
+
'ha_ng': 'Hausa',
|
| 253 |
+
'he_il': 'Hebrew',
|
| 254 |
+
'hi_in': 'Hindi',
|
| 255 |
+
'hr_hr': 'Croatian',
|
| 256 |
+
'hu_hu': 'Hungarian',
|
| 257 |
+
'hy_am': 'Armenian',
|
| 258 |
+
'id_id': 'Indonesian',
|
| 259 |
+
'ig_ng': 'Igbo',
|
| 260 |
+
'is_is': 'Icelandic',
|
| 261 |
+
'it_it': 'Italian',
|
| 262 |
+
'ja_jp': 'Japanese',
|
| 263 |
+
'jv_id': 'Javanese',
|
| 264 |
+
'ka_ge': 'Georgian',
|
| 265 |
+
'kam_ke': 'Kamba',
|
| 266 |
+
'kea_cv': 'Kabuverdianu',
|
| 267 |
+
'kk_kz': 'Kazakh',
|
| 268 |
+
'km_kh': 'Khmer',
|
| 269 |
+
'kn_in': 'Kannada',
|
| 270 |
+
'ko_kr': 'Korean',
|
| 271 |
+
'ky_kg': 'Kyrgyz',
|
| 272 |
+
'lb_lu': 'Luxembourgish',
|
| 273 |
+
'lg_ug': 'Ganda',
|
| 274 |
+
'ln_cd': 'Lingala',
|
| 275 |
+
'lo_la': 'Lao',
|
| 276 |
+
'lt_lt': 'Lithuanian',
|
| 277 |
+
'luo_ke': 'Luo',
|
| 278 |
+
'lv_lv': 'Latvian',
|
| 279 |
+
'mi_nz': 'Maori',
|
| 280 |
+
'mk_mk': 'Macedonian',
|
| 281 |
+
'ml_in': 'Malayalam',
|
| 282 |
+
'mn_mn': 'Mongolian',
|
| 283 |
+
'mr_in': 'Marathi',
|
| 284 |
+
'ms_my': 'Malay',
|
| 285 |
+
'mt_mt': 'Maltese',
|
| 286 |
+
'my_mm': 'Burmese',
|
| 287 |
+
'nb_no': 'Norwegian',
|
| 288 |
+
'ne_np': 'Nepali',
|
| 289 |
+
'nl_nl': 'Dutch',
|
| 290 |
+
'nso_za': 'Northern-Sotho',
|
| 291 |
+
'ny_mw': 'Nyanja',
|
| 292 |
+
'oc_fr': 'Occitan',
|
| 293 |
+
'om_et': 'Oromo',
|
| 294 |
+
'or_in': 'Oriya',
|
| 295 |
+
'pa_in': 'Punjabi',
|
| 296 |
+
'pl_pl': 'Polish',
|
| 297 |
+
'ps_af': 'Pashto',
|
| 298 |
+
'pt_br': 'Portuguese',
|
| 299 |
+
'ro_ro': 'Romanian',
|
| 300 |
+
'ru_ru': 'Russian',
|
| 301 |
+
'sd_in': 'Sindhi',
|
| 302 |
+
'sk_sk': 'Slovak',
|
| 303 |
+
'sl_si': 'Slovenian',
|
| 304 |
+
'sn_zw': 'Shona',
|
| 305 |
+
'so_so': 'Somali',
|
| 306 |
+
'sr_rs': 'Serbian',
|
| 307 |
+
'sv_se': 'Swedish',
|
| 308 |
+
'sw_ke': 'Swahili',
|
| 309 |
+
'ta_in': 'Tamil',
|
| 310 |
+
'te_in': 'Telugu',
|
| 311 |
+
'tg_tj': 'Tajik',
|
| 312 |
+
'th_th': 'Thai',
|
| 313 |
+
'tr_tr': 'Turkish',
|
| 314 |
+
'uk_ua': 'Ukrainian',
|
| 315 |
+
'umb_ao': 'Umbundu',
|
| 316 |
+
'ur_pk': 'Urdu',
|
| 317 |
+
'uz_uz': 'Uzbek',
|
| 318 |
+
'vi_vn': 'Vietnamese',
|
| 319 |
+
'wo_sn': 'Wolof',
|
| 320 |
+
'xh_za': 'Xhosa',
|
| 321 |
+
'yo_ng': 'Yoruba',
|
| 322 |
+
'yue_hant_hk': 'Cantonese Chinese',
|
| 323 |
+
'zu_za': 'Zulu',
|
| 324 |
+
}
|