j-tobias
added backend
752ce9b
raw
history blame
605 Bytes
from huggingface_hub import login
import json
import evaluate
import os
def hf_login():
hf_token = os.getenv("HF_TOKEN")
# if hf_token is None:
# with open("credentials.json", "r") as f:
# hf_token = json.load(f)["token"]
login(token=hf_token)
def data(dataset):
for i, item in enumerate(dataset):
yield {**item["audio"], "reference": item["norm_text"]}
def compute_wer(references, predictions):
wer_metric = evaluate.load("wer")
wer = wer_metric.compute(references=references, predictions=predictions)
wer = round(100 * wer, 2)
return wer