from vizro import Vizro
import vizro.models as vm
def read_markdown_file(file_path):
try:
with open(file_path, 'r', encoding='utf-8') as file:
content = file.read()
return content
except FileNotFoundError:
print(f"The file {file_path} does not exist.")
return None
except Exception as e:
print(f"An error occurred: {e}")
return None
# Read and print the content of text.md
file_path = 'text.md'
markdown_content = read_markdown_file(file_path)
first_page = vm.Page(
title="Visualizing data science insights. Vizro by QuantumBlack Labs, AI by McKinsey",
layout=vm.Layout(grid=[[0]]),
components=[
vm.Card(
text=markdown_content
),
],
)
dashboard = vm.Dashboard(pages=[first_page])
Vizro().build(dashboard).run()