code: def render_df(df_path: Path) -> dict:
      df = pd.read_csv(str(df_path))
  
      unique_datasets = list(df["dataset"].unique())
      measures = list(df.columns)[4:]
  
      res = {
          "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
          "data": {
              "values": df.to_dict(orient="records")
              # "url": f"benchmarks/{df_path.name}"
          },
          "params": [
              {
                  "name": "models",
                  "select": {"type": "point", "fields": ["model"]},
                  "bind": "legend",
              },
              {
                  "name": "Dataset",
                  "value": unique_datasets[0],
                  "bind": {
                      "input": "select",
                      "options": unique_datasets,
                  },
              },
              {"name": "grid", "select": "interval", "bind": "scales"},
          ],
          "transform": [
              {
                  "filter": {
                      "field": "dataset",
                      "equal": {"expr": "Dataset"},
                  }
              }
          ],
          "repeat": {"row": measures},
          "spec": {
              "width": "container",
              # "height": "container",
              "mark": "line",
              "encoding": {
                  "x": {
                      "field": "step",
                      "type": "quantitative",
                      "axis": {
                          "titleFontSize": 18,
                          "labelFontSize": 18,
                          "title": "Instance",
                      },
                  },
                  "y": {
                      "field": {"repeat": "row"},
                      "type": "quantitative",
                      "axis": {
                          "titleFontSize": 18,
                          "labelFontSize": 18,
                      },
                  },
                  "color": {
                      "field": "model",
                      "type": "ordinal",
                      "scale": {"scheme": "category20b"},
                      "title": "Models",
                      "legend": {
                          "titleFontSize": 18,
                          "labelFontSize": 18,
                          "labelLimit": 500,
                      },
                  },
                  "opacity": {
                      "condition": {"param": "models", "value": 1},
                      "value": 0.2,
                  },
              },
          },
      }
      return res
  
file_path: river/benchmarks/render.py
imports: from __future__ import annotations
  import json
  import shutil
  import textwrap
  from pathlib import Path
  import pandas
  from dominate.tags import pre
  from watermark import watermark
label_desc: Use image node_id 1 for calling a global function with example usage: render_df(df_path) and returns: res