Py.Cafe

antonymilne/

vizro-yaml-dashboard

YAML dashboard

DocsPricing
  • app.py
  • dashboard.yaml
  • requirements.txt
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
######################################################################
# Steps to check your YAML configuration works correctly:
# 1. Paste the YAML into dashboard.yaml.
# 2. Put any custom chart/action/figure/table functions definitions in this file.
# 3. Put any data_manager definitions in this file.
# 4. Check dashboard works as expected.
######################################################################
from pathlib import Path

import vizro.plotly.express as px
import yaml
from vizro import Vizro
from vizro.managers import data_manager
from vizro.models import Dashboard
from vizro.models.types import capture

data_manager["gapminder"] = px.data.gapminder()

dashboard = yaml.safe_load(Path("dashboard.yaml").read_text(encoding="utf-8"))
dashboard = Dashboard(**dashboard)

if __name__ == "__main__":
    Vizro().build(dashboard).run(debug=True)