import json import gradio as gr import pandas as pd from text import ( CITATION_BUTTON_LABEL, CITATION_BUTTON_TEXT, INTRODUCTION_TEXT, TITLE_TEXT, TASK_DESCRIPTION, DATASET_CONSTRUCTION, ) demo = gr.Blocks() with open("current_results.json") as f: result_list = json.load(f) formatted_results = [] for model in result_list["models"]: formatted_results.append( { "model": model["model"], "link": model.get("link", ""), "en": model["scores"]["en"]["mean"], # "en_std": model["scores"]["en"]["std"], "de": model["scores"]["de"]["mean"], # "de_std": model["scores"]["de"]["std"], "fr": model["scores"]["fr"]["mean"], # "fr_std": model["scores"]["fr"]["std"], "it": model["scores"]["it"]["mean"], # "it_std": model["scores"]["it"]["std"], "es": model["scores"]["es"]["mean"], # "es_std": model["scores"]["es"]["std"], "ch": model["scores"]["ch"]["mean"], # "ch_std": model["scores"]["ch"]["std"], "avg": model["avg"], "delta_non_en": model["delta_non_en"], } ) df = pd.DataFrame(formatted_results) df["model"] = df.apply( lambda x: f"{x['model']}" if isinstance(x["link"], str) else x["model"], axis=1, ) df = df[["model", "en", "de", "fr", "it", "es", "ch", "avg", "delta_non_en"]] df.columns = [ "Model", "EN πΊπΈ", "DE π©πͺ", "FR π«π·", "IT π«π·", "ES π©πͺ", "CH π¨π³", "Avg.", "Delta non-EN", ] df = df.sort_values(by=["Avg."], ascending=[False]) with demo: gr.HTML(f"