The Media block allows you to include images, GIFs, video and audio in your reports. If the file is in a supported format, it will be displayed inline in your report. To include an image, you can use dp.Media and pass the path.
1
dp.Media(file='./image.jpeg')
Copied!
In the following example, Datapane will attempt to display images in your report for viewers and allow users to download them.
If you want to include static files like PDFs or Excel docs in your report, use the dp.Attachment block. You can also pass in a Python object directly. Once you upload the report, your users will be able to explore and download these attachments.
1
import datapane as dp
2
3
myfilepath ="./financial_model.xlsx"
4
5
thisdict ={
6
"brand":"Ford",
7
"model":"Mustang",
8
"year":1964
9
}
10
11
dp.Report(
12
dp.Attachment(file= myfilepath),
13
dp.Attachment(thisdict, name='thisdict')
14
).upload(name='json')
Copied!
Embeds
The Embed block lets you embed content from other platforms e.g. Youtube, Spotify. This is how you'd use it: