import json import gradio as gr with open("results.json") as f: raw_data = json.load(f) # Extract task info task_name = raw_data.get("task", "Leaderboard") task_description = raw_data.get("description", "") # Extract rows from the new format data = raw_data["datasets"][0]["sota"]["rows"] # Sort by driving score data = sorted(data, key=lambda x: float(x["metrics"]["Driving Score"]), reverse=True) rows_html = "" for idx, d in enumerate(data, 1): # Extract paper info paper_title = d.get("paper_title", "") paper_url = d.get("paper_url", "") paper = f'📄 {paper_title}' if paper_url and paper_title else "" # Extract repository info code_links = d.get("code_links", []) if code_links and len(code_links) > 0: repo_url = code_links[0]["url"] repo = f'' else: repo = "-" row_class = "row-even" if idx % 2 == 0 else "row-odd" rows_html += f""" {d["model_name"]} {d["metrics"]["Driving Score"]} {paper} {repo} """ html = f"""

{task_name}

{task_description}

{rows_html}
Model Name Driving Score ↑ Paper Title Repository
""" with gr.Blocks(css=""" #component-0 { max-width: 1400px; margin: auto; padding: 40px 20px; } """) as demo: gr.HTML(html) demo.launch()